Cleanup
Check current disk usage:
sudo journalctl --disk-usage
Use rotate function:
sudo journalctl --rotate
Or
Remove all logs and keep the last 2 days:
sudo journalctl --vacuum-time=2days
Or
Remove all logs and only keep the last 100MB:
sudo journalctl --vacuum-size=100M
How to read logs:
Follow specific log for a service:
sudo journalctl -fu SERVICE
Show extended log info and print the last lines of a service:
sudo journalctl -xeu SERVICE
I mean yeah -fu stands for “follow unit” but its also a nice coincidence when it comes to debugging that particular service.
--vacuum-time=2days
this implies i keep an operating system installed for that long
user@u9310x-Slack:~$ sudo journalctl --disk-usage
Password:
sudo: journalctl: command not found
Thank you for this, wise sage.
Your wisdom will be passed down the family line for generations about managing machine logs.
Its semi broken currently and also functions on a whitelist with this community not being on the whitelist
Actually something I never dug into. But does logrotate no longer work? I have a bunch of disk space these days so I would not notice large log files
If logrotate doesn’t work, than use this as a cronjob via sudo crontab -e
Put this line at the end of the file:
0 0 * * * journalctl --vacuum-size=1G >/dev/null 2>&1
Everyday the logs will be trimmed to 1GB. Usually the logs are trimmed automatically at 4GB, but sometimes this does not work
Try 60GB of system logs after 15 minutes of use. My old laptop’s wifi card worked just fine, but spammed the error log with some corrected error. Adding pci=noaer to grub config fixed it.
*cough*80 GiB*cough*
You just need a bigger drive. Don’t delete anything
Once I had a mission critical service crash because the disk got full, turns out there was a typo on the logrotate config and as a result the logs were not being cleaned up at all.
edit: I should add that I used the commands shared in this post to free up space and bring the service back up