logrotate
is triggerd by cron/etc/cron.daily/logrotate
- Create a log rotation conf file in
/etc/logrotate.d
. All the files in this directory is included in/etc/logrotate.conf
- Let's add
/etc/logrotate.d/collector
for example. The contents is as follows:
/var/log/collector/log/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
sharedscripts
}
- In order to test the rotation manually, type:
sudo logrotate -f /etc/logrotate.conf
The logs should be rotated
- Check status of the log rotation by:
cat /var/lib/logrotate/status