Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-file-archive

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-file-archive

Pipe Streams to time-rotated log files

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
decreased by-29.03%
Maintainers
1
Weekly downloads
 
Created
Source

stream-file-archive

NPM

david-dm david-dm

Easy log rotation for Node.js

Supports:

  • Output your logs to time-rotated log files.
  • Optionally gzip the logs once they are no longer current
  • Optionally maintain a symlink to the currently active log file
  • Native Streams2 (0.10.x+) with backwards compatibility

Can directly plug into smart-tee, e.g.:

node foo.js 2>&1 | smart-tee --s stdout --s stream-file-archive --path logs/app-%Y-%m-%d.log

Usage:

var rotator = require("stream-file-archive")({
  path: "logs/app-%Y-%m-%d.log",  // Write logs rotated by the day
  symlink: "logs/current.log",    // Maintain a symlink called current.log
  compress: true,                 // Gzip old log files
})

my_logger_thingy.pipe(rotator)

Options

path

A string file path with any of the below options to define rotation schedule:

e.g. logs/mylog-%Y-%m-%d.log would result in logs like logs/mylog-2013-06-01.log

  • %Y 4-digit year e.g. 2013
  • %m month (01..12)
  • %d day of month (01..31)
  • %x iso8601 date portion (e.g. 2012-09-24)
  • %h hour (00..23)
  • %M minute (00..59)
  • %S second (00..61)
  • %X iso8601 time portion to the second (e.g.: 15:12:47)
  • %I iso8601 date/time to the second (e.g. 2012-09-24T15:12:47)

A path to a symlink that will be maintained to point at the current log file.

compress

Boolean value, whether to gzip the files once they aren't being written to.

NOTES:

Currently only timestamps files in UTC timezone. Pull requests welcome!

LICENSE

MIT

Keywords

FAQs

Package last updated on 26 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc