winstonjs / winston-daily-rotate-file

A transport for winston which logs to a rotating file each day.
MIT License
889 stars 151 forks source link

Not deleting old log files #372

Open splatteredbits opened 1 year ago

splatteredbits commented 1 year ago

We're using the Winston daily logger like so:

    const transport = new (winston.transports.DailyRotateFile)({
        datePattern: 'YYYYMMDD-HH0000000',
        filename: process.env.COMPUTERNAME + '_www_H%DATE%.log',
        dirname: logFolder,
        maxFiles: '14d',
        utc: true
    });

    const webLogger = winston.createLogger({
        transports: [
            transport
        ]
    });

However, it's not deleting old log files (our server name is [A-Z]{6}\d\d[A-Z]-[A-Z]{3}-\d\d, if that makes a difference):

image

I would expect that all old log files that match the datePattern and filename would be deleted.

Environment: