Logging

Setting Up Log Rotation

Learn how to set up log rotation on Linux.

  1. Create logrotate config:
sudo nano /etc/logrotate.d/myapp
  1. Sample configuration:
/var/log/myapp/*.log {
    daily
    rotate 7
    compress
    missingok
    notifempty
}
  1. Test configuration:
sudo logrotate -d /etc/logrotate.d/myapp

Read more: Logrotate Documentation