On this page
Garbage cans

How do I clear a big /var/log/journal folder?

Perform a fast and safe clearing of the /var/log/journal folder.

Can we remove files from the /var/log/journal folder? Yes, indeed. It’s completely fine as long as you don’t require the logs for troubleshooting.

The problem

The /var/log/journal folder takes up a lot of space on the system.

How do I safely clear a big /var/log/journal folder?

You can safely clean /var/log/journal and delete all of the files there, but you cannot delete the directory itself.

Determine how much disc space /var/log/journal consumes

sudo journalctl --disk-usage
Example output: journalctl --disk-usage
Archived and active journals take up 4.0G in the file system.

Clear (reduce) the folder size instantly

Let’s say you want to reduce the log size to a specific size. Let’s then delete old log files from the /var/log/journal folder and reduce the folder size to 100 MB.

sudo journalctl --vacuum-size=100M
Example fragment output: sudo journalctl --vacuum-size=100M
Deleted archived journal /var/log/journal/a507f97b935f4660bfd8ef6e1aa296d4/system@868984e0359c48dbbf3abb3f0adde391-0000000003055c74-0006023627fd12d6.journal (72.0M).
Vacuuming done, freed 3.8G of archived journals from /var/log/journal/a507f97b935f4660bfd8ef6e1aa296d4.

Note that vacuuming only removes archived journal files, not active ones. To remove everything, you must first rotate the files so that recent entries are moved to inactive files.

sudo journalctl --rotate
sudo journalctl --vacuum-time=1s

Control the amount of disc space that /var/log/journal can utilise

  1. We can change the configuration file /etc/systemd/journald.conf manually.

    sudo nano /etc/systemd/journald.conf
  2. Add the following line at the bottom of the configuration file.

  3. Then, on your keyboard, press Ctrl+X to exit the Nano text editor. Before quitting, you will be asked to confirm that you wish to save the changes. To save and leave Nano, simply press Y on your keyboard, then press Enter.

  4. To force a log rotation, you may need to restart the logging service.

    sudo systemctl restart systemd-journald.service

Related posts


Leave a Reply

Real-user monitoring for Accessibility, Performance, Security, SEO & Errors (SiteLint)