journalctl in depth: persistence, filtering, quotas, and vacuum
Fedora 45’s journald is nearly zero-config: persistence is on by default. This page covers everything daily log hunting needs.
Start with the current state
Section titled “Start with the current state”ls -d /var/log/journal && echo persistentjournalctl --disk-usagejournalctl --list-boots | wc -lMeasured on an F45 box after a few days:
persistentArchived and active journals take up 64M in the file system.6Three facts: logs are on disk (survive reboot), currently 64 MiB, six boots recorded. The config lives in /usr/lib/systemd/journald.conf (every vendor default commented out; Fedora does not ship a copy under /etc — configure via drop-ins, below).
Filtering: the three dimensions you actually use
Section titled “Filtering: the three dimensions you actually use”# by unitjournalctl -u sshd --since today# by priority (emerg..debug; err and above)journalctl -p err -b# by timejournalctl --since "1 hour ago" --until "10 min ago"Measured on an F45 box: -u sshd --since today yields 316 lines, -p warning 384 — the filtered count is the readable one.
The everyday debugging combo:
journalctl -u nginx -p err --since "24 hours ago" --no-pager | tail -20Other frequent flags: -b (this boot), -b -1 (previous boot — see why it died), -f (follow, like tail -f), --no-pager (for scripts).
Output formats: human vs machine
Section titled “Output formats: human vs machine”journalctl -u sshd -o short-iso --no-pager | tail -12026-10-29T07:25:27+00:00 fd45-repo sshd-session[8068]: pam_unix(...)short-iso gives second-precision ISO timestamps and greps cleanly. For programs, use JSON:
journalctl -u sshd -o json --no-pager | tail -1{"SYSLOG_TIMESTAMP":"Oct 29 07:25:27 ","_SYSTEMD_INVOCATION_ID":"609ee5064af24fa", ...}Every field (__MONOTONIC_TIMESTAMP, _PID, MESSAGE, …) is present; jq '.MESSAGE' extracts the payload.
Quotas: SystemMaxUse via drop-in
Section titled “Quotas: SystemMaxUse via drop-in”journald self-limits by default (roughly 10% of disk, capped at 4 GiB). To set it explicitly:
sudo mkdir -p /etc/systemd/journald.conf.dprintf "[Journal]\nSystemMaxUse=200M\n" | \ sudo tee /etc/systemd/journald.conf.d/size.confsudo systemctl restart systemd-journaldMeasured: after restart the service is active, and oversized journals rotate away in the background. For retention time use MaxRetentionSec (vendor default 0 = unlimited).
Vacuum: reclaim right now
Section titled “Vacuum: reclaim right now”Quotas are a standing policy; --vacuum-* is a one-shot action:
sudo journalctl --vacuum-size=50M # keep 50Msudo journalctl --vacuum-time=7d # keep 7 dayssudo journalctl --vacuum-files=5 # keep 5 archivesMeasured on a 64M box, --vacuum-size=50M reported “freed 0B” — below the target it deletes nothing. That is correct behaviour, not a malfunction.
Common traps
Section titled “Common traps”| Symptom | Cause |
|---|---|
| logs gone after reboot | Storage=volatile, or /var/log/journal deleted; verify with ls -d /var/log/journal |
| journald.conf change had no effect | edited the vendor file, or no restart of systemd-journald |
--vacuum-size deleted nothing | current usage below the target, expected |
-f shows nothing for your service | wrong unit name; confirm with systemctl list-units | grep name |
| endless duplicate lines | the app logs to stdout and journald collects it too; lower app log level |
| journal fills the disk | no SystemMaxUse set; add the drop-in above |
Related pages
Section titled “Related pages”- systemd services and timers — units and their logs
- fail2ban — a typical journal-backed consumer
- Backup and restore — whether to back up logs
- Upstream: journalctl manual