It is possible to do hourly log rotation in Winston?
node.js, winston
Solution
You can rotate Winston logs hourly. You need to provide hour (`HH`) in date pattern.
Please check the sample code below:
var winston = require ('winston');
var path = require ('path');
var transports = [];
transports.push(new winston.transports.DailyRotateFile({
name: 'file',
datePattern: '.yyyy-MM-ddTHH',
filename: path.join("some_path", "log_file_name.log")
}));
var logger = new winston.Logger({transports: transports});
// ... and logging
logger.info("some info log ...", {extraData: 'abc'});
File names will be as follows: `log_file_name.log.2013-12-17T16`, `log_file_name.log.2013-12-17T17` etc.
I hope that will help.
Problem
Hi i have a requirement from our production team, I need to create the logs hourly, I know that winston support daily, but this doesn't help me. It is possible to do this?