by Joseph Anthony C. Hermocilla, Principal Consultant
I've been using Digital Ocean to provision web servers through Droplets. However, I noticed that a server's available disk space is reduced after some time. I found out that the culprit is Systemd's Journald service.
Having worked on Linux servers for a time, I know the most likely directory containing large files is /var. I started looking for large files there using the following command line:
$sudo du -h --max-depth=1 /var
The result is that /var/log is occupying GB of space! I rerun the command line:
$sudo du -h --max-depth=1 /var/log
This time, the largest folder is /var/log/journal.
To reclaim the disk space occupied by the logs, I used the command line below:
$sudo journalctl --vacuum-size=50M
The above fix is only temporary. To make it permanent, I set the following parameter in /etc/systemd/journald.conf:
I then restarted the service:
$sudo systemctl restart systemd-journald
Hopefully, next time my web servers will not run out of disk space.