LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

What is logrotate and why is it important?

logrotate periodically renames, compresses, and eventually deletes old log files so they don't grow until they fill the disk.

Plain-text logs grow forever — a chatty service can fill /var and take the system down. logrotate is the housekeeper that caps this: on a schedule (run by cron or a systemd timer) it "rotates" each managed log so only a bounded amount of history is kept.

What a rotation does:

  • renames the current log to make room (messagesmessages.1, .1.2, …)
  • compresses the aged-out copies to .gz to save space
  • deletes anything past the retention count
  • can run a post-rotation script (e.g. signal the daemon to reopen its log file)

Configuration:

  • /etc/logrotate.conf - Main config
  • /etc/logrotate.d/ - Per-service configs

Example config:

/var/log/messages {
    # Rotate weekly
    weekly
    # Keep 4 old versions
    rotate 4
    # Gzip old logs
    compress
    # Don't compress most recent
    delaycompress
    # Don't error if file missing
    missingok
    # Don't rotate if empty
    notifempty
}

Manual rotation:

logrotate -f /etc/logrotate.conf

Tip: Without logrotate, logs can fill your disk!

From Quiz: LIOS / Logs, Processes and Services | Updated: Jun 20, 2026