Sphere
Log in Join
☆ 6

systemd journal ate 12gb and now the box is unhappy

journalctl --disk-usage says 12.4G on an Ubuntu 22.04 box with a 40G root disk. /var/log/journal is the culprit. There's a service logging every HTTP request at info level, so a few thousand lines a minute. journalctl --vacuum-time=7d freed some but it came back within a week. What's the right way to cap this permanently? It came back within a week after I vacuumed once.

⚑ Report

4 replies

☆ 0
R rust21 ·2026-10-03#1

Set SystemMaxUse and RuntimeMaxUse in /etc/systemd/journald.conf, for example SystemMaxUse=2G and MaxRetentionSec=1week. Then systemctl restart systemd-journald. That caps the on-disk journal regardless of how chatty your services are. Also set SystemMaxFileSize to keep individual files manageable. Restarting journald every few days isn't a real solution.

⚑ Report
☆ 0
F ferret ·2026-10-05#2

Set SystemMaxUse=2G and restarted journald. Disk usage dropped after the next vacuum. But the noisy service is still writing thousands of lines a minute, which can't be good for CPU. Can I rate-limit it in journald? The disk is fine for now but the CPU is noticeable.

⚑ Report
☆ 0
S so ·2026-10-11#3

journald has RateLimitIntervalSec and RateLimitBurst, but those throttle all services unless you set them per-unit in the service file. The real fix is to lower the log level in that app, or send its logs to a file and only log errors to the journal.

⚑ Report
☆ 0
C cod ·2026-10-22#4

We added StandardOutput=append:/var/log/app/access.log to that service so access logs bypass the journal, and left error output going to journald. Combined with SystemMaxUse=1G, the journal has stayed under control for months. Worth checking that logrotate handles the new file too. It didn't, at first.

⚑ Report
Log in to reply.