Can I delete files in /var/log/journal?

In the directory /var/log/journal/ are kept the log files created by the journal service (systemd).
Sometimes, this directory can have a large size. You can check with the du command or by using the journalctl –disk-usage command as:

root@web [~]# journalctl --disk-usage
Archived and active journals take up 934.1M on disk.
root@web [~]#

journalctl is a utility that allows querying the contents of the systemd journal

Info for the argument used above:

–disk-usage
Shows the current disk usage of all journal files. This shows the sum of the disk usage of all archived and active journal files.

It’s ok to clear a little these files if you don’t need the log data. You can just delete the files, but the best method is to use the journalctl utility as:

journalctl --vacuum-size=200M

If you see the size of the directory /var/log/journal is still large, change the value 200M to 100M etc.

Info for this argument:

–vacuum-size=, –vacuum-time=, –vacuum-files= Removes archived journal files until the disk space they use falls below the specified size (specified with the usual “K”, “M”, “G” and “T” suffixes), or all archived journal files contain no data older than the specified timespan (specified with the usual “s”, “m”, “h”, “days”, “months”, “weeks” and “years” suffixes), or no more than the specified number of separate journal files remain.

For more journalctl information, check the manual with the man journalctl command.

Related KB article: How to get the size of a directory in Linux

This Post Has One Comment

  1. Batu

    Thanks 🙂

Leave a Reply