Setting Up Log Rotation
Learn how to set up log rotation on Linux.
- Create logrotate config:
sudo nano /etc/logrotate.d/myapp
- Sample configuration:
/var/log/myapp/*.log {
daily
rotate 7
compress
missingok
notifempty
}
- Test configuration:
sudo logrotate -d /etc/logrotate.d/myapp
Read more: Logrotate Documentation