Ubuntu: configure systemd log size

In this tutorial, we will see how to configure the size of systemd logs on an Ubuntu distribution.

By default, the logs located in the /var/log/journal folder can take several gigabytes of disk space.

As can be seen from the screenshot below, the logs take up 4 Giga of disk space.

The configuration of the logs is done in the file /etc/systemd/journald.conf.

Here is the default file:

Open the file with nano for example:

sudo nano /etc/systemd/journald.conf

Uncomment the SystemMaxUse line and set the desired maximum log size value.

Here I indicated a maximum size of 200 Mo

Close saving changes.

Restart the daemon in charge of the systemd journal:

sudo systemctl restart systemd-journald

After the reboot, we can see that the logs are the size indicated and the rest has been deleted.

Romain Drouche
System Architect | MCSE: Core Infrastructure
IT infrastructure expert with over 15 years of field experience. Currently a Systems and Networks Project Manager and Information Systems Security (ISS) expert, I use my expertise to ensure the reliability and security of technological environments.

Leave a Comment