journald

cleaning up using journalctl

January 04, 2024



Check disk usage of journald logs

$ journalctl --disk-usage
# Possible output:
Archived and active journals take up 704.0M in the file system.

Clean up and retain by a given time:

$ sudo journalctl --vacuum-time=2d
# Possible output:
...
Vacuuming done, freed 680.0M of archived journals from /var/log/journal/48753f2b2bee4a29bbf47847a0fc7315.
Vacuuming done, freed 0B of archived journals from /run/log/journal

Clean up and retain by a given size:

$ sudo journalctl --vacuum-size=500M
# Possible output:
Vacuuming done, freed 0B of archived journals from /run/log/journal.
Vacuuming done, freed 0B of archived journals from /var/log/journal/48753f2b2bee4a29bbf47847a0fc7315.
Vacuuming done, freed 0B of archived journals from /var/log/journal.
...

The above clean up commands can also be combined with:

# Flush any log data stored in /run/log/journal/ into /var/log/journal/
journalctl --flush
# Request immediate rotation of the journal files
journalctl --rotate
# Show the user journal for the current user
journalctl --user

For mre information see:

man journalctl
journalctl --help