context-switch.com / Resources

TECHNICAL REFERENCE · NOVEMBER 2026

logrotate quick reference

Where to look

/etc/logrotate.conf defines global defaults; /etc/logrotate.d/ contains per-service rules.

Example rule

/var/log/example/*.log {
    weekly
    rotate 8
    missingok
    notifempty
    compress
    delaycompress
    create 0640 syslog adm
}

Inspect without changing files

sudo logrotate -d /etc/logrotate.conf

Force a test with care

sudo logrotate -vf /etc/logrotate.d/example

Notes

The -d flag is debug/dry-run. Rotation can be initiated by a systemd timer or cron, depending on distribution. Applications that hold open file descriptors may need a signal or reopen hook.