Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotating file stream not working if maxsize = 1kb or frequency is 1 minute. Does this library really works #387

Open
mai1x9 opened this issue Jan 19, 2024 · 2 comments

Comments

@mai1x9
Copy link

mai1x9 commented Jan 19, 2024

  level: 'info',
  filename: 'application-%DATE%.log',
//   datePattern: 'YYYY-MM-DD-HH',
    frequency: '1m',
  zippedArchive: true,
  maxSize: '1kb',
  maxFiles: '14d'
});

As expected even if size of log is > 1kb it is not rotated. Even freqeuncy is not working .

@mdk000
Copy link

mdk000 commented Mar 7, 2024

@mai1x9 try to disable archiving as @hyavari suggested in #380 (comment).

Archiving and deleting at the same time doesn't make sense :)

@xnubber
Copy link

xnubber commented Jun 25, 2024

@mai1x9

the situation below will work

// frequency work
const transport = new winston.transports.DailyRotateFile({
  filename: application-%DATE%.log,
  datePattern: 'YYYY-MM-DD_HH-mm-ss',
  frequency: '3600s',
  zippedArchive: true,
  maxSize: '30k',
  maxFiles: '14d'
});

but this won't

// frequency not work
const transport = new winston.transports.DailyRotateFile({
  filename: application-%DATE%.log,
  datePattern: 'YYYY-MM-DD_HH-mm-ss',
  frequency: '1h',
  zippedArchive: true,
  maxSize: '30k',
  maxFiles: '14d'
});

and if log file reaches maxSize , after archived , the new log filename will be exactly "application-%DATE%.log"...
so weird ...

on the other hand, the maxSize should be "1k" not "1kb"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants