keymetrics / pm2-logrotate

Automatically rotate all applications logs managed by PM2
1.25k stars 138 forks source link

Feature: Can we add an action of rotating logs on demand #164

Open gaurav-cointab opened 4 years ago

gaurav-cointab commented 4 years ago

Hi,

Can we have an option of rotating logs on demand. For example can we have an option from command line where when we execute it, it can rotate logs for all the apps, or for targeted apps via pm2 command line.

For example (something of this sort) pm2 rotate logs [1,all,"app name"]

eagleyes commented 2 years ago

I agree that we need a trigger to manually force a logrotation like linux logrotate command.

Right now I would like the application to rotate the logs each time it is restarted so that when we look at logs they are fresh from latest restart. This is not possible with this plugin and forces me to look for another way and will not use pm2-logrotate... will probably stick with system logrotate function since it has that capability.

let me know if it is possible to implement .