Rotate log files automatically using `pm2-logrotate`

  1. Install this module
pm2 install pm2-logrotate
  1. Config this module

The following is an example of configuring pm2-logrotate. Other configuration items are similar to being configured. Please check current configuration or pm2 official documentation for detailed configuration items.

pm2 set pm2-logrotate:max_size 100M
  1. Check whether this module is active
pm2 list

If this module is working you should be able to see its status in the "Module" section.

  1. Check current configuration of this module
pm2 conf pm2-logrotate

  1. Check logs of pm2-logrotate
pm2 logs pm2-logrotate
  1. Reload pm2-logrotate
pm2 reload pm2-logrotate