How to Cleanup a /Var/Log/Journal in Linux


You may find your /var/log/journal directory taking up a lot of disk-space.

How do you go about removing, or deleting all these files under var log journal without the system complaining and falling over?

How to tell how much space is being taken?

You can ask the journalctl command directly, using the --disk-usage argument:

journalctl --disk-usage

It will report something like this:

Journals take up 3.9G on disk.

Fix: Option 1 (not ideal):

Go and adjust its config under /etc/systemd/journald.conf, making sure to pay attention to the SystemMaxUse key; set this to something reasonable, like 50M perhaps.

At this point you can force a log rotation by issuing this command:

sudo systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service

Remember to restart the systemctl process, like this:

sudo systemctl restart systemd-journald.service

You could always go and delete the offending /var/log/journal/** directory contents, but this is not the recommended way, as the system journal could be writing here, which will probably cause you bigger problems!

Simply run the following command to cleanup the /var/log/journal directory:

journalctl --vacuum-size=500M

This will delete old log files until the directory reaches the threshold size stipulated, in our case, 500M.

It really is that easy to clear or clean up your var log journal!