I have the following logrotate configuration:
/var/log/app.*/*.log {
su root root
daily
missingok
notifempty
create 0644 root root
rotate 4
}
/var/log/app.*/*.log
are the files where pm2 write logs.
The problem is when the files are rotated pm2 starts writing to *.log.1
files. When rotated again it writes to *.log.2
files.
I've found two solutions,
use
copytruncate
in the logrotate configuration.run
pm2 reload ecosystem.config.js
My use case is such that I don't want to use copytruncate
neither do I wanna reload pm2.
Any suggestions will be highly appreciated.