journald Log Management: Retention, Filtering, and Forwarding
journald is the default log sink on every systemd distro, and most of it runs on defaults nobody chose. Here is how to actually control it.
Key takeaways
- Make journald logs survive reboots by setting Storage=persistent or creating /var/log/journal, then cap disk use with SystemMaxUse and SystemKeepFree in journald.conf.
- Filter with journalctl -u, -p, --since and -b -1 for the previous boot.
- Forward to a central stack with a native journald input so structured fields survive.
On this page
Control journald with three settings in /etc/systemd/journald.conf: Storage=persistent so logs survive reboots, SystemMaxUse= and SystemKeepFree= to cap disk use, and MaxRetentionSec= for time-based retention. Restart systemd-journald, check with journalctl --disk-usage, and filter with journalctl -u, -p and -b -1 instead of grep.
Verified against
systemd 262, against the freedesktop.org journald.conf(5) and journalctl(1) man pages. Checked October 2026.
Every systemd-based distro ships journald capturing stdout/stderr and structured metadata from every service, but most boxes run it on defaults nobody chose. On older systemd releases and some distro builds that includes Storage=auto, which keeps logs in /run (and loses them on every reboot) when /var/log/journal doesn't exist. That surprises people exactly once, usually while trying to find what a service logged right before it crashed and rebooted the box.
Check whether logs even survive a reboot
journalctl --disk-usage
Archived and active journals take up 96.0M in the file system.
cat /etc/systemd/journald.conf | grep -i storage
#Storage=auto
Storage=auto means: log to /var/log/journal if that directory exists, otherwise fall back to volatile /run/log/journal, which is wiped on every reboot. Upstream systemd 262 documents persistent as the default (a compile-time choice), but the commented-out line in your distro's file tells you what your build actually uses. If /var/log/journal doesn't exist on your box, your journal history is one reboot away from gone:
ls -d /var/log/journal 2>&1
ls: cannot access '/var/log/journal': No such file or directory
Fix it by creating the directory and restarting the journal:
sudo mkdir -p /var/log/journal
sudo systemd-tmpfiles --create --prefix /var/log/journal
sudo systemctl restart systemd-journald
journald picks up persistent storage automatically once the directory exists; Storage=auto was already going to use it. To move what is still in /run onto disk without waiting for a reboot, run sudo journalctl --flush.
Control how much disk it's allowed to eat
The size defaults are the other surprise. SystemMaxUse= defaults to 10% of the filesystem and SystemKeepFree= to 15%, each capped at 4G, and journald honors whichever is smaller. On a small root volume that is a few gigabytes nobody budgeted; on a shared /var it can be up to 4G of logs. Set explicit caps instead, ideally in a drop-in such as /etc/systemd/journald.conf.d/60-retention.conf so package upgrades don't fight you:
[Journal]
Storage=persistent
SystemMaxUse=2G
SystemKeepFree=1G
SystemMaxFileSize=100M
MaxRetentionSec=30day
SystemMaxUse: hard cap on total journal disk usage.SystemKeepFree: journald stops writing before it eats into this much free disk space, regardless ofSystemMaxUse. This is the guard against journald itself causing a disk-full incident.SystemMaxFileSize: size at which a journal file is rotated. The default is one eighth ofSystemMaxUse, capped at 128M.MaxRetentionSec: deletes journal files older than this even if under the size cap. It defaults to 0 (off), so set it when you want a time-bounded retention policy rather than a size-bounded one.
sudo systemctl restart systemd-journald
journalctl --disk-usage
To reclaim space right now without changing config, rotate and vacuum the archived files: sudo journalctl --rotate --vacuum-size=1G or --vacuum-time=14d. Both act only on archived files, which is why --rotate goes first. Relying on percentage defaults, a chatty service in a crash loop can still eat gigabytes faster than most people expect. This is the same failure mode as disk full on Linux, just journald-flavored.
Filtering: journalctl beyond -f
journalctl -u nginx --since "1 hour ago"
journalctl -u nginx -p err # priority: only error and above
journalctl -u nginx --since "2026-08-29 09:00" --until "2026-08-29 09:15"
journalctl -k # kernel messages, current boot only
journalctl -f -u nginx -u postgresql # follow multiple units interleaved by time
Priority filtering (-p) accepts syslog levels (emerg, alert, crit, err, warning, notice, info, debug) and includes everything at or above the given level; -p err shows err, crit, alert, and emerg, not just exact matches.
Structured field filtering is where journald earns its keep over flat text logs: every entry carries metadata you can query directly:
journalctl _PID=12345
journalctl _SYSTEMD_UNIT=nginx.service _COMM=nginx
journalctl -o json-pretty -u nginx -n 1 # see every field a unit's entries actually carry
That last command is the fastest way to discover what's queryable for a given service; every key in the JSON output is a valid filter field.
Correlating a crash with what came before it
systemctl status myapp
# note the PID and the boot it crashed in, then:
journalctl -u myapp -b -1 -n 100 # last 100 lines from the *previous* boot
journalctl -u myapp --since "-10min" -p warning
-b -1 is easy to forget and is exactly what you need after a crash-triggered reboot. Without -b, journalctl -u searches every boot in the journal and you scroll past the restart; -b 0 or plain -b shows only the current boot, which doesn't contain the crash at all. Run journalctl --list-boots to see which boot offsets exist.
Forwarding to a centralized logging stack
journald's own storage is local and rotates; for anything you need retained past that or searchable across a fleet, forward it. Two common paths:
Forward to traditional syslog (if you already run rsyslog or syslog-ng, which then ships elsewhere):
[Journal]
ForwardToSyslog=yes
ForwardToSyslog= is off by default; when enabled it writes to the /run/systemd/journal/syslog socket. The man page notes that most syslog daemons read the journal files directly instead, so check your rsyslog config before turning it on and getting duplicates.
Ship structured JSON directly with a log shipper reading the journal natively (Vector, Fluent Bit, and Grafana Alloy all support journald as a native input, avoiding a syslog translation step and keeping the structured fields intact). For quick piping, journalctl's own JSON output works:
journalctl -o json --since "5 min ago" -f | your-shipper-of-choice
Reading the journal as JSON preserves fields like _SYSTEMD_UNIT, _PID, and PRIORITY as structured data in whatever downstream system receives it, instead of flattening everything back into a single text line the way syslog forwarding does.
The fix in order
journalctl --disk-usageand checkStorage=: confirm logs are persistent (/var/log/journalexists) before you need history that a reboot just erased.- Set
SystemMaxUse/SystemKeepFreeexplicitly. Don't run without a disk cap, especially on any box where a crash-looping service could write logs faster than it fails. - Use
-u,-p,--since/--until, and structured field filters (_PID=,_SYSTEMD_UNIT=) instead of piping throughgrep; journald's own filtering is faster and more precise. - After a crash-reboot,
journalctl -u <service> -b -1: the previous boot, not the current one. - Forward to a real logging stack for anything you need retained or searched across more than one host; native journald input (Vector, Fluent Bit, Grafana Alloy) keeps structured fields that syslog forwarding flattens away. If the bill for that stack is the worry, our cheapest log management options breakdown is the next read.
This pairs with debugging a systemd service that fails to start for the service-management side of the same daemon, and diagnosing disk full on Linux when journald itself turns out to be what filled the disk.
Questions people ask
How do I limit journald log size?
Set SystemMaxUse= (for example 2G) and optionally SystemKeepFree= in /etc/systemd/journald.conf or a drop-in under journald.conf.d/, then run sudo systemctl restart systemd-journald. Without them journald uses 10% of the filesystem for SystemMaxUse and keeps 15% free, each capped at 4G. To free space immediately, run sudo journalctl --rotate --vacuum-size=1G.
Why are my journalctl logs gone after a reboot?
The journal was in volatile storage under /run/log/journal, which lives in memory. That happens when Storage=volatile, or when Storage=auto and /var/log/journal does not exist. Create the directory or set Storage=persistent, restart systemd-journald, and later boots keep history. Logs lost before the change are not recoverable.
How do I see logs from the previous boot?
Run journalctl -b -1, optionally with -u yourservice to narrow it to one unit. -b -1 selects the boot before the most recent one, -b -2 the one before that, and journalctl --list-boots lists every boot the journal still holds. This only works with persistent storage, because volatile journals do not survive the reboot you are investigating.
The call we'd make
Set Storage=persistent and an explicit SystemMaxUse/SystemKeepFree on every box on day one. It costs one config file and prevents both "logs vanished on reboot" and "journald filled the disk." Forward to a real logging stack the moment you need retention or cross-host search beyond what a single box's local journal can give you.
Sources
Cite this article
Kiril Urbonas (2026). journald Log Management: Retention, Filtering, and Forwarding. DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/journald-log-management-linux
[journald Log Management: Retention, Filtering, and Forwarding](https://www.devopsness.com/blog/journald-log-management-linux) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)
More from Linux
Explore more articles in this category
Find What's Eating Your RAM on Linux
A practical method for reading free, top, and ps correctly so you attribute Linux memory to a real cause instead of guessing.
Tracking Down High CPU on Linux
A field-tested workflow for finding which process burns your CPU and whether the time is user, system, or iowait.
Linux System Monitoring with Prometheus and Grafana
Set up comprehensive Linux system monitoring using Prometheus and Grafana. Monitor CPU, memory, disk, network, and application metrics with beautiful dashboards.
You might have missed
Evergreen posts worth revisiting.