User Tools

Site Tools


linux:ubuntu_clear_journal_log

Ubuntu Clear Journal Log

Now the journal log can accumulate quite a lot of disk space over time if you don't clean it up every once in a while.

To check the amount of space used run the following command.

journalctl --disk-usage

Start with rotating the logs. This will mark the currently active journal logs as archive and create fresh new logs.

journalctl --rotate

Next you will have a few options on how to proceed.

1: Clear journal log older than x days

journalctl --vacuum-time=2d

2: Restrict logs to a certain size.

journalctl --vacuum-size=100M

3: Restrict number of log files.

journalctl --vacuum-files=5

Automatically clearing old log files i.e let the system do it. The configuration file that handles this is located here.

/etc/systemd/journald.conf

You will need to uncomment the settings you wish to tweak. What you are looking for are these settings.

Setting Description
SystemMaxUse Max disk space logs can take
SystemMaxFileSize Max size of an INDIVIDUAL log file
SystemMaxFiles Max number of log files

Example:

[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
#RateLimitIntervalSec=30s
#RateLimitBurst=1000
SystemMaxUse=250M
#SystemKeepFree=
#SystemMaxFileSize=
#SystemMaxFiles=100
linux/ubuntu_clear_journal_log.txt · Last modified: 26/10/2022 09:32 by Allan