On a default Ubuntu server, journald keeps its logs in memory. Reboot the box and the evidence of what happened before the reboot is gone. That is fine on a laptop and indefensible on a server you might have to explain to an auditor. Two settings fix the disappearing act, three more stop the journal eating the disk, and a handful of journalctl flags turn the result into something you can actually search at 2am. This is the configuration I put on every Linux server I own, on systemd-journald 255 shipped with Ubuntu 24.04.
Why your logs vanish on reboot
The culprit is the default value of Storage, which is auto. Under auto, journald writes persistently only if the directory /var/log/journal already exists. If it does not — and on a fresh Ubuntu install it does not — journald writes to /run/log/journal, which lives on a tmpfs in RAM. That storage is volatile by design. Every reboot starts the journal from empty, and you lose everything up to the last boot.
The second latent problem is size. Left to its own devices journald sizes itself relative to the filesystem: SystemMaxUse defaults to 10% of the volume and SystemKeepFree to 15%, each capped at 4G. On a small root partition that 10% can still be more than you want a log directory consuming, and the interaction between the two defaults is not obvious until a disk-usage alert wakes you up. Better to state the numbers you actually want.
Free · 4 minutes
Is your engineering team shipping safely, or quietly accumulating risk?
Fourteen questions on how work gets from idea to production — cadence, testing, rollback, and the key-person risk in your delivery. Banded finding on screen, full sheet by email.
A journald.conf that caps the disk
Do not edit the shipped /etc/systemd/journald.conf directly — a package upgrade can prompt you to merge it. Use a drop-in instead. Files in /etc/systemd/journald.conf.d/ override the defaults and survive upgrades cleanly.
# /etc/systemd/journald.conf.d/00-persistent.conf
# Drop-in override; leaves the packaged journald.conf untouched.
[Journal]
Storage=persistent
Compress=yes
# Hard ceiling on disk usage: the journal never exceeds this.
SystemMaxUse=2G
# Always leave at least this much free for everything else.
SystemKeepFree=1G
# Cap a single journal file so rotation stays granular.
SystemMaxFileSize=256M
# Time-based retention: discard anything older than 90 days,
# whichever of size or age is hit first.
MaxRetentionSec=90day
# Rate limiting: allow 20000 messages per 30s per service
# before dropping, so one chatty unit cannot blank the log.
RateLimitIntervalSec=30s
RateLimitBurst=20000
Storage=persistent forces the persistent path and creates /var/log/journal for you. The three size settings work together: SystemMaxUse is the absolute ceiling, SystemKeepFree is the floor of free space journald refuses to cross, and journald honours whichever bites first. MaxRetentionSec adds a time bound on top — useful when a retention policy is stated in days rather than gigabytes. The rate-limit pair matters more than people expect: the default is 10,000 messages in 30 seconds per service, and a misbehaving unit hitting that limit will have its messages silently dropped, which is the worst possible failure mode during an incident.
Apply it, create the persistent directory, and flush what is currently in RAM across to disk:
sudo mkdir -p /etc/systemd/journald.conf.d
sudo install -m 0644 00-persistent.conf /etc/systemd/journald.conf.d/
sudo systemctl restart systemd-journald
sudo journalctl --flush # move /run journal into /var
# Confirm the effective, merged configuration
sudo systemd-analyze cat-config systemd/journald.conf
# Confirm where the bytes are now going
journalctl --disk-usage
If you ever need to reclaim space immediately without waiting for the caps to apply, journalctl vacuums on demand: journalctl --vacuum-size=500M, journalctl --vacuum-time=30d, or journalctl --vacuum-files=5 to keep only the most recent journal files.
Querying like you mean it
Persistent logs are only worth having if you can interrogate them fast. journalctl is a query engine, not a flat file — filter on the server rather than piping the whole thing into grep.
# Everything from one unit, this boot only
journalctl -u nginx.service -b
# A precise time window, narrowed to warnings and worse
journalctl --since "2026-10-20 09:00" --until "2026-10-20 10:30" -p warning
# Follow one unit live, like tail -f but structured
journalctl -u ssh.service -f
# Errors and above across the whole system, this boot
journalctl -b -p err -o short-precise
# Kernel messages from the previous boot (-b -1)
journalctl -k -b -1
# Full-text search across the journal for a string
journalctl -g "connection refused" --since today
# Export a unit's logs as a portable incident bundle
journalctl -u myapp.service --since "2026-10-20" --until "2026-10-21" \
-o export > /tmp/myapp-incident.journal
A few of these earn their keep repeatedly. -p takes a priority name or number (err is 3, warning is 4) and also takes a range, so -p warning..err brackets exactly what you want. -b selects a boot: no argument is the current one, -b -1 the previous, which is how you read what happened before the reboot you are now investigating — the whole point of making the journal persistent. -o export writes the native binary export format for re-import elsewhere; for a bundle a human will read, use -o json or -o short-iso instead.
Retention a supervisor will accept
For a regulated firm the retention numbers are not an operational preference — they are a control. A 90-day MaxRetentionSec is a starting point, not a target; set it to whatever your logging and incident-reconstruction obligations actually require, and be able to show that the running configuration matches the policy on paper. The systemd-analyze cat-config output above is exactly the evidence a reviewer will ask for: the effective, merged settings, not the aspirational document. If your obligations run to tamper-evidence and structured capture as well as duration — as they increasingly do — the journal is one input among several, and the wider picture is in automatic logging under AI Act Article 12.
One boundary worth drawing clearly: journald manages the systemd journal, and only that. Application logs written to their own files under /var/log are outside its remit and need logrotate for the logs systemd does not manage. And if you want a scheduled journal export or off-box copy to run reliably, a systemd timer rather than cron is the mechanism that survives reboots and logs its own failures back into the journal you just configured.
The default journald configuration is tuned for a workstation nobody audits. A server is neither. Ten minutes with a drop-in file buys you logs that outlive a reboot, a disk that cannot be filled by them, and a retention window you can defend — and the alternative is discovering, mid-incident, that the record you needed was in a tmpfs that cleared itself hours ago.
Free interactive tool
Website compliance checklist
What your site has to do, based on what it actually does
Answer as much or as little as you like — the list builds as you go. Nothing is stored against your name and no email is required.
Everything that applies
Ordered by what to do first: legal requirements you can close quickly, then larger pieces of work, then what is expected rather than required. Not exhaustive, and not a legal audit.
Dated PDF, yours to keep or circulate.
Most technology problems are not technology problems. They are control problems.
The systems exist. The investment has been made. The question is whether leadership can understand, direct, evidence, and sustain what those systems produce. Find out where control exists — and where it only appears to.