MayWares

Notes on small software — building, deploying, and keeping it running.

Logrotate defaults that make sense on a 20 GB disk

August 30, 2026 · 4 min read

A friend asked why his tiny VPS had run out of disk. The answer, as usual: logs. Not because anything was wrong — nothing was — but because the stock rotation policy keeps 4 weeks of rotated logs plus whatever journald decides to hold, and on a 20 GB root filesystem that quietly adds up.

The three knobs that matter

/var/log/nginx/*.log {
    daily
    rotate 7
    maxsize 50M
    missingok
    notifempty
    compress
    delaycompress
    sharedscripts
    postrotate
        invoke-rc.d nginx rotate >/dev/null 2>&1
    endscript
}

Don't forget journald

Logrotate only handles files under /var/log; journald keeps its own binary journals with separate limits. The one line I set on every small box, in /etc/systemd/journald.conf:

SystemMaxUse=200M

Then systemctl restart systemd-journald. Between that and the rotate policy above, logs stay under half a gigabyte forever — which is exactly the amount of disk a blog's logs deserve.

The actual lesson

Small-disk machines don't die from big mistakes, they die from defaults sized for servers ten times larger. Audit the defaults once, write them down, and the problem never comes back.