Logging & Journald
Stop letting your system logs eat all your disk space
đź§© The Challenge
Dealing with a production server that suddenly hits 100 percent disk usage because journald decided to hoard gigabytes of old binary logs is a special kind of hell. I’ve spent too many early mornings clearing out logs by hand just to get the OS to breathe again.
đź’ˇ The Fix
You can clamp down on how much space the journal is allowed to take up by editing the config file and setting a hard limit. It’s a “set it and forget it” fix that keeps your root partition from exploding.
sed -i 's/#SystemMaxUse=/SystemMaxUse=500M/' /etc/systemd/journald.conf && systemctl restart systemd-journald
⚙️ Why It Works
By modifying the SystemMaxUse directive, you’re explicitly telling the journal daemon to prune the older segments once the directory hits that specific size threshold. It’s way better than running manual cleanup scripts every time the disk alerts go off.
🚀 Pro-Tip: Use journalctl –disk-usage to see exactly how much space you’re currently burning through before you apply the cap.
Linux Tips & Tricks | © ngelinux.com | 9/25/2026
