Gathering detailed insights and metrics for winston-daily-rotate-file
Gathering detailed insights and metrics for winston-daily-rotate-file
Gathering detailed insights and metrics for winston-daily-rotate-file
Gathering detailed insights and metrics for winston-daily-rotate-file
A transport for winston which logs to a rotating file each day.
npm install winston-daily-rotate-file
Typescript
Module System
Min. Node Version
Node Version
NPM Version
94.9
Supply Chain
96.8
Quality
79.6
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
248,444,592
Last Day
55,400
Last Week
849,156
Last Month
3,531,219
Last Year
39,176,528
MIT License
920 Stars
248 Commits
157 Forks
22 Watchers
2 Branches
47 Contributors
Updated on Jul 02, 2025
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
winston-daily-rotate-file@5.0.0
Unpacked Size
26.56 kB
Size
7.66 kB
File Count
6
NPM Version
10.2.3
Node Version
18.19.0
Published on
Feb 09, 2024
Cumulative downloads
Total Downloads
Last Day
2.3%
55,400
Compared to previous day
Last Week
-3.8%
849,156
Compared to previous week
Last Month
4.4%
3,531,219
Compared to previous month
Last Year
-48.6%
39,176,528
Compared to previous year
1
A transport for winston which logs to a rotating file. Logs can be rotated based on a date, size limit, and old logs can be removed based on count or elapsed days.
Starting with version 2.0.0, the transport has been refactored to leverage the file-stream-rotator module. Some of the options in the 1.x versions of the transport have changed. Please review the options below to identify any changes needed.
Please note that if you are using winston@2
, you will need to use winston-daily-rotate-file@3
. winston-daily-rotate-file@4
removed support for winston@2
.
Starting with version 5.0.0 this module also emits an "error" event for all low level filesystem error cases. Make sure to listen for this event to prevent crashes in your application.
This library should work starting with Node.js 8.x, but tests are only executed for Node.js 14+. Use on your own risk in lower Node.js versions.
npm install winston-daily-rotate-file
The DailyRotateFile transport can rotate files by minute, hour, day, month, year or weekday. In addition to the options accepted by the logger, winston-daily-rotate-file
also accepts the following options:
datePattern
for the rotation times. (default: null)%DATE%
placeholder which will include the formatted datePattern at that point in the filename. (default: 'winston.log.%DATE%'){ flags: 'a' }
)audit_file
. If not specified, a file name is generated that includes a hash computed from the options object, and uses the dirname
option value as the directory. (default: <dirname>/.<optionsHash>-audit.json
)createLogger
method will be used1 var winston = require('winston'); 2 require('winston-daily-rotate-file'); 3 4 var transport = new winston.transports.DailyRotateFile({ 5 level: 'info', 6 filename: 'application-%DATE%.log', 7 datePattern: 'YYYY-MM-DD-HH', 8 zippedArchive: true, 9 maxSize: '20m', 10 maxFiles: '14d' 11 }); 12 13 transport.on('error', error => { 14 // log or handle errors here 15 }); 16 17 transport.on('rotate', (oldFilename, newFilename) => { 18 // do something fun 19 }); 20 21 var logger = winston.createLogger({ 22 transports: [ 23 transport 24 ] 25 }); 26 27 logger.info('Hello World!'); 28
using multiple transports
1 var winston = require('winston'); 2 require('winston-daily-rotate-file'); 3 4 var transport1 = new winston.transports.DailyRotateFile({ 5 filename: 'application-%DATE%.log', 6 datePattern: 'YYYY-MM-DD-HH', 7 zippedArchive: true, 8 maxSize: '20m', 9 maxFiles: '14d' 10 }); 11 12 var transport2 = new winston.transports.DailyRotateFile({ 13 level: 'error', 14 filename: 'application-error-%DATE%.log', 15 datePattern: 'YYYY-MM-DD-HH', 16 zippedArchive: true, 17 maxSize: '20m', 18 maxFiles: '14d' 19 }); 20 21 transport1.on('error', error => { 22 // log or handle errors here 23 }); 24 25 transport2.on('error', error => { 26 // log or handle errors here 27 }); 28 29 transport1.on('rotate', function(oldFilename, newFilename) { 30 // do something fun 31 }); 32 33 transport2.on('rotate', function(oldFilename, newFilename) { 34 // do something fun 35 }); 36 37 var logger = winston.createLogger({ 38 level: 'info' 39 transports: [ 40 transport1, // will be used on info level 41 transport2 // will be used on error level 42 ] 43 }); 44 45 logger.info('Hello World!'); 46 logger.error('Hello Error!'); 47
1import * as winston from 'winston'; 2import 'winston-daily-rotate-file'; 3 4 5const transport = new winston.transports.DailyRotateFile({ 6 filename: 'application-%DATE%.log', 7 datePattern: 'YYYY-MM-DD-HH', 8 zippedArchive: true, 9 maxSize: '20m', 10 maxFiles: '14d' 11}); 12 13transport.on('error', error => { 14 // log or handle errors here 15}); 16 17transport.on('rotate', (oldFilename, newFilename) => { 18 // do something fun 19}); 20 21const logger = winston.createLogger({ 22 transports: [ 23 transport 24 ] 25}); 26 27logger.info('Hello World!');
1 2import * as winston from 'winston'; 3import DailyRotateFile from 'winston-daily-rotate-file'; 4 5const transport: DailyRotateFile = new DailyRotateFile({ 6 filename: 'application-%DATE%.log', 7 datePattern: 'YYYY-MM-DD-HH', 8 zippedArchive: true, 9 maxSize: '20m', 10 maxFiles: '14d' 11}); 12 13transport.on('error', error => { 14 // log or handle errors here 15}); 16 17 18transport.on('rotate', (oldFilename, newFilename) => { 19 // do something fun 20}); 21 22const logger = winston.createLogger({ 23 transports: [ 24 transport 25 ] 26}); 27 28logger.info('Hello World!');
This transport emits the following custom events:
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/20 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More@abtnode/winston-daily-rotate-file
A transport for winston which logs to a rotating file each day.
@zwave-js/winston-daily-rotate-file
A transport for winston which logs to a rotating file each day.
@zigasebenik/winston-daily-rotate-file
A transport for winston which logs to a rotating file each day.
springuper-winston-daily-rotate-file
A transport for winston which logs to a rotating file each day.