Safe to Delete

Linux /var/log Folder & Journalctl Logs

Quick Answer: /var/log and systemd journal logs record Linux system events. Vacuuming old logs via journalctl --vacuum-size is safe and recovers lost space.

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, journalctl archives):100% safe.
  • Manually deleting the /var/log folder 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.

  1. Open your Linux terminal.
  2. Check how much disk space journal logs are currently using:
    journalctl --disk-usage
  3. Vacuum logs down to a max size (e.g., 200 MB):
    sudo journalctl --vacuum-size=200M
  4. 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:

  1. Edit /etc/systemd/journald.conf:
    sudo nano /etc/systemd/journald.conf
  2. Uncomment or add the line:
    SystemMaxUse=500M
  3. Save and exit (Ctrl + O, Enter, Ctrl + X), then restart journald:
    sudo systemctl restart systemd-journald

Discussion

Loading authentication...

Related in linux

Linux Audit Framework Log Directory (/var/log/audit)

The Linux auditd service records security events, file access traces, and user commands in /var/log/audit. Learn how to clean auditd log files safely.

Safe to Delete

Fail2ban Ban History Database (/var/lib/fail2ban/fail2ban.sqlite3)

Fail2ban intrusion prevention daemon logs banned IP addresses and SSH brute-force attempts in fail2ban.sqlite3. Clearing Fail2ban database is safe.

Safe to Delete

GNOME Desktop File Indexer Database (~/.local/share/tracker/data)

GNOME Tracker caches desktop search index databases. Resetting the tracker database is safe.

Safe to Delete
Back to all files