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 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 it’s 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

Fix: Option 2 (not recommended):

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!

Fix: Option 3 (RECOMMENDED!):

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.

5 2 votes
Article Rating
Notify of
Inline Feedbacks
View all comments