How to Clean Systemd Journal Logs to Free Up Disk Space in Ubuntu

Ubuntu and modern Linux distributions use systemd-journald as their primary logging daemon. This service collects and indexes kernel messages, system service events, boot sequences, and user-space errors in binary journal files. While invaluable for diagnosing hardware problems and software errors, systemd logs are retained indefinitely by default until they reach a predetermined percentage of your filesystem. Over months or years of regular desktop use, these log files in /var/log/journal can grow to consume 4 GB to 10 GB or more, triggering low disk space warnings on smaller SSD partitions. Here is how to inspect, clean, and permanently limit systemd journal logs in Ubuntu.

Checking Current Journal Log Disk Usage

Before deleting any log files, determine exactly how much disk capacity the systemd journal is currently occupying on your system:

  1. Open the Terminal application from your Ubuntu dash or press Ctrl + Alt + T.
  2. Enter the following command and press Enter:
journalctl --disk-usage

The terminal will return a clear summary line, for example: Archived and active journals take up 4.2G in the file system. If this figure exceeds your storage tolerance, you can safely trim these archived logs without disrupting your operating system.

How to Safely Clean (Vacuum) Journal Logs

Never manually delete files inside /var/log/journal/ using standard rm commands, as this can corrupt the binary indexing database. Instead, use the built-in --vacuum parameters provided by journalctl.

Option 1: Vacuum by Log Age

If you only want to keep logs from recent days and purge older historical data, specify a time duration:

sudo journalctl --vacuum-time=7d

This command instructs systemd to delete all archived log entries older than seven days, retaining only the past week of diagnostic records.

Option 2: Vacuum by Total Disk Size

If your goal is freeing up a specific amount of disk space, specify a maximum allowable size limit:

sudo journalctl --vacuum-size=200M

This command trims older archived journal files until the total disk space consumed by the journal falls below 200 megabytes.

Verifying Journal File Integrity

After vacuuming old log archives, it is good administrative practice to verify that the remaining active journal database files are healthy and free from corruption:

sudo journalctl --verify

The utility will scan each active binary archive and report PASS next to healthy files. If any damaged or truncated files are detected, systemd will flag them for automatic rotation.

How to Permanently Limit Journal Log Size

Vacuuming frees up space immediately, but without configuration changes, the journal will gradually expand back to its original size over time. You can permanently cap maximum journal storage in the configuration file:

  1. In your terminal, open the journal configuration file using the nano text editor:
sudo nano /etc/systemd/journald.conf
  1. Scroll down to the [Journal] section.
  2. Locate the line reading #SystemMaxUse=.
  3. Delete the # symbol to uncomment the line and specify your preferred limit (for example, 200 megabytes):
SystemMaxUse=200M
  1. Press Ctrl + O followed by Enter to save the changes, then press Ctrl + X to exit the editor.
  2. Restart the systemd-journald service to apply the new restriction immediately:
sudo systemctl restart systemd-journald

Summary of Useful Journalctl Cleaning Commands

Command Function Recommended Application
journalctl --disk-usage Displays current disk space consumed by logs Initial diagnostic check before maintenance.
sudo journalctl --vacuum-size=200M Deletes oldest archives until size is under 200 MB Immediate relief during low disk space alerts.
sudo journalctl --vacuum-time=2weeks Removes log archives older than 14 days Periodic monthly maintenance on desktop machines.
sudo journalctl --rotate Forces active journal into archive for safe cleanup Run immediately prior to vacuuming if logs are locked.

Frequently Asked Questions

Is it safe to delete systemd journal logs?

Yes, provided you use the official journalctl --vacuum commands. Active processes will continue writing new events to the active log file, while only older historical logs are pruned. Your running system will not experience any instability.

Can I turn off systemd logging completely?

While technically possible by setting Storage=none in journald.conf, doing so is strongly discouraged. Without system logs, troubleshooting software crashes, network connection failures, or hardware kernel panics becomes virtually impossible.

Why does journalctl require sudo to vacuum?

System logs contain security events, system authentication records, and service states across all users on the computer. Administrative (root) privileges are required to modify or delete these protected system records.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.