how to delete journal logs in ubuntu

to check on the Systemd Journal

$ du -hs /var/log/journal/
4.0G /var/log/journal/
$ sudo rm -rf /var/log/journal/

if you want to keep some entries, you can clear lets say whatever older than 7days

$ sudo journalctl --vacuum-time=7d
Vacuuming done, freed 1.1G of archived journals from /var/log/journal/....

you can clear whatever exceeds a specific value, lets say 500MB

$ sudo journalctl --vacuum-size=500M (use G for Gigs)
Vacuuming done, freed 2G of archived journals from /var/log/journal/b79152a915e44e2eab9434a3dfcd6b1c.

to set the SystemMaxUse in a value of your preference:

$ sudo vi /etc/systemd/journald.conf
...
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=10000
SystemMaxUse=200M
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100


Leave a Reply