I have following settings set for PM2 Logrotate:
rotateInterval= * * 23 * * *
max_size= 100MB
I want to rotate the logs every 23 hours and/or keep max 100MB log files. But for some odd reason, the PM2 Logrotate keeps rotating / creating new log files way too often so I loose the ability to see the history of the logs, i. e pm2 logs --lines 300
only displays that a new log has been created. This is the output I see in the terminal:
pm2-logrotate > "/root/.pm2/logs/scraper-init-out-1__2017-06-01_08-00-25.log" has been created
pm2-logrotate > "/root/.pm2/logs/pm2-logrotate-out-2__2017-06-01_08-00-25.log" has been created
pm2-logrotate > "/root/.pm2/logs/pm2-logrotate-out-2__2017-06-01_08-00-55.log" has been created
pm2-logrotate > "/root/.pm2/logs/pm2-logrotate-out-2__2017-06-01_08-01-25.log" has been created
What am I doing wrong here?
I had the same problem as you. Change max_size from 100MB
to 100M
. The documentation has the default for max_size as 10MB
but options it gives are 10G, 10M, 10K
. Apparently it doesn't know what to do with MB
vs M
.