Your small VPS is almost full, clean up your journal logs

Published at Oct 21, 2025

Sponsored by

unolia.com

All your domains in one place. Helps you find problems, gives you performance and security insights!


Want to sponsor this blog ? Contact me or use Github sponsor

Running a small VPS for your side projects? You might notice your disk filling up mysteriously. Before upgrading your plan or deleting important files, check your systemd journal logs – they're often the silent disk space killer.

The problem

By default, systemd journal logs everything: every service start, every error, every SSH attempt. On a small VPS, these logs can grow to several gigabytes without you noticing.

Check your current journal size:

Copied!
sudo journalctl --disk-usage

If you see anything over 1GB on a small VPS, you're wasting precious disk space.

In my case, /var/log/journal was eating 3.1GB on a 25GB VPS. That's 12% of my total disk space!

Immediate fix

Clean up old logs by deleting logs older than a certain time or limiting the total size:

Copied!
sudo journalctl --vacuum-time=7d # keep only last 7 days
sudo journalctl --vacuum-size=500M # keep only 500MB of logs

Permanent fix – Limit current log growth

To prevent this from happening again, you can configure systemd to limit the size and retention of journal logs.

Edit the journal configuration:

Copied!
sudo nano /etc/systemd/journald.conf

Uncomment and adjust these values to your preference:

Copied!
SystemMaxUse=500M
SystemKeepFree=1G
MaxRetentionSec=7day

Restart the service:

Copied!
sudo systemctl restart systemd-journald

That's it!

You just freed several gigabytes and prevented the problem from happening again.

#vps #linux #ubuntu #logs

Syntax highlighting provided by torchlight.dev