Search code examples
node.jswinston

How can I limit the winston log files to a specific number


I am thinking of using the log rotation feature of Winston. Is there any way to limit the number of log files. For example if I am rotating files daily, is there a way to specify I want to keep only logs for last three days ?


Solution

  • From the comments - @Aleksandr M

    maxFiles is that property.

    It could read like this:

    dailyRotateFile: {
        colorize: false,
        timestamp: true,
        datePattern: '.yyyy-MM-ddTHH-mm',
        filename: filename,
        maxFiles: 5,
        maxsize: 100000000,
        json: false
    }