background

There are too many log files in the production environment, resulting in insufficient disk space. Temporarily delete some systemctl logs to solve the problem.

step

First, stop systemd-journaldthe service:

sudo systemctl stop systemd-journald

Clean the log files:

sudo journalctl --vacuum-size=100M

The above command will clean log files exceeding 100MB in size. You can adjust --vacuum-sizethe parameter values ​​as needed to set different cleaning thresholds.

Delete archived log files:

sudo journalctl --vacuum-time=7d

The above command will delete archived log files older than 7 days. You can adjust --vacuum-timethe parameter values ​​as needed to set different time ranges.

Finally, restart systemd-journaldthe service:

sudo systemctl start systemd-journald

After performing the above steps, systemdthe log files will be cleaned to free up disk space. Please note that these operations may require administrator rights to perform.