PM2 Logrotate does'nt turn every days - configuration

1.3k Views Asked by At

My node application is currently using pm2 for console logging, I need to create a logger that logs warnings and errors only and saves the logs to a log file. It should rotate interval and restarts every day of 01h00. This is my current pm2 config:

 "max_size": "50M",
 "compress": true,
 "rotateInterval": "* * 1 * * *"

This configuration does not rotate every day.

What i missed ?

1

There are 1 best solutions below

1
eol On BEST ANSWER

I think your crontab is wrong, it should be:

  ...
 "rotateInterval": "0 1 * * *"
  ...

You can check https://crontab.guru to try/debug your crontab.