If you’ve run an ncdu scan of your disk and found /var/log/journal near the top, you’re not alone. The systemd journal keeps a binary log of everything your system does, and on a machine that has been running for a while it can easily reach several gigabytes. Here’s how to clean up journalctl logs safely, and then stop them growing out of control again.
Check how big the journal is
journalctl --disk-usage
This reports the combined size of all active and archived journal files. If it’s in the hundreds of megabytes on a desktop, you can probably leave it. Several gigabytes is worth trimming.
How journal files work (and why it matters)
journald writes to active files and periodically rotates them into archived files. The vacuum commands below only ever delete archived files – the files currently being written are left alone. That’s what makes vacuuming safe, but it also means the result can look smaller than expected. To include recent data, rotate first:
sudo journalctl --rotate
Rotation marks the current files as archived and starts fresh ones, so a vacuum straight afterwards can cover everything written so far.
Vacuum by size
Remove the oldest archived files until the journal is under a target size. Suffixes K, M, G and T are accepted:
sudo journalctl --vacuum-size=500M
Vacuum by age
Remove archived files older than a given timespan:
sudo journalctl --vacuum-time=2weeks
# other examples: 7days, 1months, 1years
Vacuum by file count
sudo journalctl --vacuum-files=5
This keeps only the specified number of separate journal files. Active files are never removed, so you may end up with slightly more than you asked for.
Warning: vacuumed logs are gone for good. If you’re investigating a crash, a security incident or an intermittent fault, export what you need first, for example journalctl -b -1 > previous-boot.log, before trimming. On servers with audit or compliance requirements, check your retention policy before deleting anything.
Rotate and vacuum in one go
You can combine options in a single command:
sudo journalctl --rotate --vacuum-size=500M
Then confirm with journalctl --disk-usage.
Set permanent limits in journald.conf
Vacuuming is a one-off. To stop the journal growing back, set limits in journald’s configuration. Rather than editing /etc/systemd/journald.conf directly, the systemd documentation recommends a drop-in file, which survives package upgrades cleanly:
sudo mkdir -p /etc/systemd/journald.conf.d
sudo nano /etc/systemd/journald.conf.d/60-journal-size.conf
Add a [Journal] section with the limits you want:
[Journal]
SystemMaxUse=500M
SystemKeepFree=1G
MaxRetentionSec=1month
SystemMaxUse=– the maximum space the persistent journal may use. By default it’s 10% of the filesystem, capped at 4G.SystemKeepFree=– how much space journald must leave free for everything else. The default is 15%, again capped at 4G. Whichever of the two limits is stricter wins.MaxRetentionSec=– deletes journal files containing entries older than this. It defaults to 0 (disabled).SystemMaxFileSize=– the size of individual journal files before rotation; most people can leave this alone.
Apply the change by restarting the journal daemon:
sudo systemctl restart systemd-journald
journald only deletes archived files to stay within these limits, so usage can sit slightly above the cap until the next rotation. That’s normal.
Volatile versus persistent storage
The Storage= option decides where logs live. With persistent, logs go to /var/log/journal and survive reboots. With volatile, they live in memory under /run/log/journal and vanish at shutdown. On auto, journald uses persistent storage only if /var/log/journal exists. Switching to volatile saves disk but makes debugging boot problems much harder, so I’d only do it on throwaway VMs or very small devices.
Troubleshooting
- Vacuum freed almost nothing: most data is still in active files. Run
sudo journalctl --rotatefirst, then vacuum again. - Limits seem ignored: check for a typo in the section header (it must be
[Journal]) and that the drop-in ends in.conf. Then restartsystemd-journald. - Journal files reported as corrupted: run
journalctl --verify. journald normally renames damaged files and carries on; vacuuming will eventually remove them. - Still short on space: the journal is rarely the only culprit – see clearing package caches on Linux and my wider guide on how to free up disk space on Linux.
Set sensible limits once and you shouldn’t have to think about the journal again.

Leave a Reply
You must be logged in to post a comment.