How to delete journalctl log safely?
29/04/2023
@ Saigon
Linux
First of all, it’s important to know how much space has been used for journalctl log. There are many method to get this information, in this post, I would like to introduce two method.
- Disk Usage (
du
command), given that logs stored in/var/log/journal
. You can use this following command.
- Using
journalctl --disk-usage
Now, come back to our main topic - deleting journalctl log safely.
- Delete log data by time, in this example, it only keeo 7-day old data.
- Delete log data by disk usage, in the following example, it only keeps data up 1GB. This command uses
G
for Gigabyte,M
for Megabyte,K
for Kilobyte.