Bottom Line: You can safely clear old log files in /var/log and vacuum systemd journal logs using journalctl. Doing so will not destabilize Linux, and can free up 2 GB to over 15 GB of system disk space.
What is the Linux /var/log Directory?
Located at /var/log on Ubuntu, Debian, Fedora, Arch, and CentOS, this directory is the central logging location for the Linux kernel, system services, and background daemons.
The Journalctl Log Bloat
Modern Linux distributions use systemd-journald to store system logs inside /var/log/journal. By default, journald may be configured to use up to 10% of your total filesystem space. On a system running for months, journal logs and rotated log archives (*.gz, *.1) accumulate endlessly.
Can You Delete /var/log Files?
- Deleting old rotated logs (
*.gz,journalctlarchives): ✅ 100% safe. - Manually deleting the
/var/logfolder itself: ❌ Do NOT delete the directory structure. Certain daemons crash if their specific log subfolder doesn’t exist.
How to Safely Clean Up Linux Logs
Always use journalctl and safe maintenance commands rather than rm -rf /var/log.
Method 1: Vacuum Systemd Journal Logs (Recommended)
- Open your Linux terminal.
- Check how much disk space journal logs are currently using:
journalctl --disk-usage - Vacuum logs down to a max size (e.g., 200 MB):
sudo journalctl --vacuum-size=200M - Or vacuum logs older than 7 days:
sudo journalctl --vacuum-time=7d
Method 2: Delete Old Compressed Log Archives
Remove old archived log files ending in .gz or .1 inside /var/log:
sudo rm -f /var/log/*.gz /var/log/*.1 /var/log/*/*.gz
Prevent Journal Logs from Bloating in the Future
To cap systemd journal log size permanently:
- Edit
/etc/systemd/journald.conf:sudo nano /etc/systemd/journald.conf - Uncomment or add the line:
SystemMaxUse=500M - Save and exit (
Ctrl + O,Enter,Ctrl + X), then restart journald:sudo systemctl restart systemd-journald
Related Guides
- Learn about deleting Ubuntu Snap package cache.
- How to clean up [Docker overlay2 storage].
- Check if you can clean Linux tmp folder.
Discussion
Loading authentication...