
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
winston-logrotate
Advanced tools
Winston's default file transport rotation creates new logs daily, or if the file exceeds a max size, but it does not expunge old logs. This means that an additional module must be used to delete old log files.
winston-logrotate provides a transport with full support for size based
rotation, compression and pruning log files.
winston-logrotate uses
logrotate-stream under the
covers, which is used to perform compression/rotation and winston's
common.log to get timestamps, colorization, and log formatting.
| Field | Required | Description |
|---|---|---|
| file | yes | The filename of the logfile to write output to. |
| colorize | no | Boolean flag indicating if we should colorize output. |
| timestamp | no | Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps. |
| json | no | If true, messages will be logged as JSON (default true). |
| size | no | The max file size of a log before rotation occurs. Supports 1024, 1k, 1m, 1g. Defaults to 100m |
| keep | no | The number of rotated log files to keep (including the primary log file). Defaults to 5 |
| compress | no | Optionally compress rotated files with gzip. Defaults to true. |
Require:
require('winston-logrotate');
Create a rotate transport:
var rotateTransport = new winston.transports.Rotate({
file: '/tmp/my.log', // this path needs to be absolute
colorize: false,
timestamp: true,
json: false,
size: '100m',
keep: 5,
compress: true
});
and add it to default winston logger:
winston.add(rotateTransport)
or create a custom logger using the transport:
var logger = new (winston.Logger)({ transports: [rotateTransport] });
FAQs
Log rotating transport for Winston
We found that winston-logrotate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.