code & network

Limiting systemd-journal disk usage

2025-02-09

Found a server where /var/log/journal had quietly grown to over 3GB. The default journald config keeps logs until disk is 10% full, which on small VPSes is more than you want.

Two lines in /etc/systemd/journald.conf fix it:

SystemMaxUse=200M
MaxRetentionSec=1month

Then systemctl restart systemd-journald and the older entries get vacuumed on the next rotation. If you want to free space immediately, journalctl --vacuum-size=200M does it on the spot.

Worth doing once on every fresh server before you forget it exists.