Logging & Journald
Stop journald from eating all your disk space
đź§© The Challenge
You finally get the disk-full alert at 3 AM because journald decided that keeping every single boot log for the last three years was more important than your database writing to disk. I have wasted way too many hours clearing out massive log files by hand because I didn’t set a limit early on.
đź’ˇ The Fix
Edit your journal configuration to cap the maximum size or the time span of your logs, which forces the system to rotate them out before they balloon into a nightmare. You get to keep the logs you actually need without sacrificing your server’s entire capacity.
sudo mkdir -p /etc/systemd/journald.conf.d
echo -e "[Journal]\nSystemMaxUse=500M\nMaxRetentionSec=1month" | sudo tee /etc/systemd/journald.conf.d/limits.conf > /dev/null
sudo systemctl restart systemd-journald
⚙️ Why It Works
Setting SystemMaxUse defines a hard limit for the total disk space consumed by the journal, and MaxRetentionSec tells the daemon to prune old entries automatically so you don’t have to play janitor. It’s a set-it-and-forget-it fix for a problem that shouldn’t exist in the first place.
🚀 Pro-Tip: Run journalctl –disk-usage right now to see just how much space you’re currently hemorrhaging.
Linux Tips & Tricks | © ngelinux.com | 8/5/2026
