Support

Blog

Browsing all articles tagged with linux

Journalctl keeps logs on the servers for systemd.
The default settings can lead to too much disk space use. Logs are good to have, but the default settings are unlimited, and if you do not watch out they can get up to gigabytes in size. A more reasonable default is 100M, as this will still allow you to debug any non-running systemd scripts and not take up too much valuable disk space.

To reduce journalctl disk usage, we can clean up the un-needed logs, and optionally reduce the disk space needed to keep logs.

To Show disk usage:

journalctl --disk-usage

To clean up disk usage (to 100M in size):

journalctl --vacuum-size=100M

To make this the default for future, we can edit the systemd journald settings and set the logs to a more reasonable size.:


pico /etc/systemd/journald.conf

//Uncomment the SystemMaxUse line and set to 100M
SystemMaxUse=100M

//Save and exit CTRL O, CTRL X, Enter to save

//Finally restart systemd
systemctl restart systemd-journald

Note: Logs can be seen by checking one of the running services. These usually sit in /etc/systemd/system or /etc/systemd/user.
e.g. to check php 8.3 fpm service logs

journalctl -xeu php8.3-fpm.service

Archives

Categories

Tags

PHOTOSTREAM