0

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 ?

Motra
  • 93
  • 1
  • 7

1 Answers1

2

I think your crontab is wrong, it should be:

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

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

eol
  • 23,236
  • 5
  • 46
  • 64
  • And yet I had tested that too: "0 23 * * *" hoping that the rotate rotates every 23:00. But it didn't work. This proposal is almost identical to what you are proposing. – Motra Oct 08 '20 at 12:00