How to clear systemd journal Logs

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.

 

Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

Leave a Reply