Utilize the journalctl command tool to efficiently handle systemd journal logs on your system. Clearing unnecessary logs can help reclaim disk space. Here are a couple of methods based on your preferences:
Clear Systemd Log Older Than a Specific Time:
To retain logs from the last two days, execute the following command:
sudo journalctl –vacuum-time=2d
Read: How to analyze Linux systemd logs using journalctl advanced filtering options
Limit Journal Logs by Size:
To restrict journal logs to 500 MB, run the following command:
sudo journalctl –vacuum-size=500M
Before using these options, initiate log rotation:
sudo journalctl –rotate
This practice archives active journal files, generating fresh ones. For more details and additional options, refer to the journalctl man page or explore relevant web articles.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.