Last updated on November 27, 2023
1. Determine which logs you want to clean: Use the command “journalctl –disk-usage” to see how much space your logs are taking up. If you want to clean all logs, skip this step.
journalctl --disk-usage
2. Clear the logs: Use the command “journalctl –vacuum-size=500M” to clear logs that are larger than 500MB. Adjust the size parameter as needed. Alternatively, you can use “journalctl –vacuum-time=2weeks” to clear logs older than two weeks.
journalctl --vacuum-size=500M
3. Verify the logs have been cleared: Use the command “journalctl –disk-usage” again to verify that the logs have been cleared.
journalctl --disk-usage
4. Restart the journald service: Use the command “sudo systemctl restart systemd-journald.service” to restart the journald service.
sudo systemctl restart systemd-journald.service
5. Verify the service is running: Use the command “sudo systemctl status systemd-journald.service” to verify that the journald service is running.
sudo systemctl status systemd-journald.service
** Or simply clear all logs with the following commands
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
Note: It’s important to be cautious when clearing logs, as some logs may contain important information for troubleshooting issues. Always make sure you have a backup of your logs before clearing them.