Search code examples
node.jspm2pm2-logrotate

PM2 Logrotate does'nt turn every days - configuration


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 ?


Solution

  • I think your crontab is wrong, it should be:

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

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