๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Linux journald Logs Missing: Persistence, Rate Limits, Rotation

Linux journald Logs Missing: Persistence, Rate Limits, Rotation

A service crashed overnight and the host rebooted. You run journalctl -b -1 to read the last boot and get an error saying that boot is not available, or the first line is timestamped after the crash. Or a flapping unit logged thousands of lines and the only trace is a single "Suppressed 48213 messages" entry. Either way, the journald logs you needed are missing, and the instinct is to start editing journald.conf at random.

Missing entries come from five distinct causes: never stored, suppressed, rotated away, not visible to your user, or not forwarded to rsyslog. Each has a different fix, and guessing wastes time during an incident. This part gives you the order of checks, then covers the first two causes in detail.

Find out which kind of missing you have

Check boots, time range and disk usage first

Three commands tell you most of what you need:

journalctl --list-boots
journalctl --disk-usage
journalctl -o short-precise | head -n 3

If --list-boots shows a single boot (index 0) on a host that has rebooted, the journal did not survive restarts. If it lists several boots but the oldest entry is only days old, something deleted history. --disk-usage reports the combined size of archived and active journal files, and "No journal files were found" means journald has nothing readable for you at all. The exact wording of boot errors varies between systemd versions.

Tell 'never written' from 'written and removed'

Look at where the files live:

ls -la /var/log/journal /run/log/journal

/run/log/journal is on tmpfs and disappears at reboot. /var/log/journal is on disk and persists. If only the /run directory exists and holds a machine-ID subdirectory, you are on volatile storage.

Run journalctl --verify as well. It checks each file and reports PASS or FAIL per file. A corrupted or truncated file is skipped or only partly read, which can look like a gap.

Then work down this list in order:

  1. Not persistent: only /run/log/journal exists.
  2. Rate-limited: a "Suppressed N messages" line sits where the gap is.
  3. Vacuumed: the journal is on disk but size or age limits removed old files.
  4. Not permitted: the data exists but your user cannot read it.
  5. Not forwarded: the journal has the lines, but /var/log/syslog does not.

Logs vanish at reboot: enabling persistent storage

How Storage=auto decides where to write

The Storage= key in journald.conf accepts volatile, persistent, auto and none. With auto, journald writes to /var/log/journal only if that directory already exists. Otherwise it falls back to /run/log/journal, and everything is gone at the next boot. Distributions differ on whether they create the directory, so check with ls -ld /var/log/journal instead of assuming.

none is the nasty one: all received data is dropped, though forwarding to console or a syslog socket still works. Some hardening profiles and container images set it. Check with systemd-analyze cat-config systemd/journald.conf, which shows every drop-in that applies.

Turning persistence on with a drop-in

Set it explicitly rather than relying on a directory existing:

sudo mkdir -p /etc/systemd/journald.conf.d
sudo tee /etc/systemd/journald.conf.d/10-persistent.conf <<'EOF'
[Journal]
Storage=persistent
EOF
sudo systemctl restart systemd-journald

With persistent, journald creates /var/log/journal itself. The directory should end up group systemd-journal with the setgid bit and ACLs, so members of that group and admin groups can read it. If permissions look wrong, sudo systemd-tmuxfiles is not a thing; use sudo systemd-tmpfiles --create --prefix /var/log/journal to restore them. The journald.conf(5) man page documents every value.

Flushing the runtime journal without a reboot

sudo journalctl --flush
journalctl --list-boots

This moves the current boot's entries from /run/log/journal into /var/log/journal, so the present boot is kept from now on. Boots that already ended on volatile storage cannot be recovered. Their data lived only in RAM.

Suppressed messages: journald rate limiting

Reading the 'Suppressed N messages' line

journald logs the suppression itself, under its own identity, not under the noisy unit. So searching the offending unit will not find it:

journalctl -u systemd-journald | grep -i suppressed
journalctl -t systemd-journald --since "-2h"

Expect lines like Suppressed 48213 messages from foo.service. The defaults are RateLimitIntervalSec=30s and RateLimitBurst=10000, applied per service. A unit that exceeds 10000 messages in 30 seconds loses the rest of that window.

Raising RateLimitBurst globally or per unit

Prefer a per-unit override so one service cannot flood the whole journal. The keys are LogRateLimitIntervalSec= and LogRateLimitBurst= in systemd.exec(5):

sudo systemctl edit foo.service
# add:
[Service]
LogRateLimitIntervalSec=30s
LogRateLimitBurst=50000

To change the global default, put RateLimitIntervalSec= and RateLimitBurst= under [Journal] in a drop-in and restart systemd-journald. Setting either to 0 disables limiting, which risks disk and CPU pressure during a real flood.

Fixing the noisy service instead

Raising limits only hides the symptom. Check whether the unit is crash-looping:

systemctl show -p NRestarts foo.service

A large count with Restart=always and a tiny RestartSec= is a classic flood source. Other usual suspects are debug logging left on after a troubleshooting session. The kernel's own printk rate limiting is separate from all of this, and rsyslog has its own limits, covered later in this series. For quick journal queries while you triage, keep the Systemd Journal Log Analysis Cheat Sheet open.

Rotation and vacuuming: when limits delete your history

Default size limits and how to read them

Without configuration, SystemMaxUse= is 10% of the filesystem and SystemKeepFree= is 15%, with the maximum capped at 4G. Check journald.conf(5) for your version, since the details have shifted over time. Whichever limit is hit first triggers deletion of the oldest archived files.

$ journalctl --disk-usage
Archived and active journals take up 392.0M in the file system.

On a 5 GB /var with a chatty service, that is a few hundred megabytes, which can be only hours of history. The "missing" lines were evicted, not lost.

Setting SystemMaxUse, MaxRetentionSec and SystemKeepFree

[Journal]
SystemMaxUse=2G
SystemMaxFileSize=128M
MaxRetentionSec=1month

Save it as /etc/systemd/journald.conf.d/20-limits.conf and restart systemd-journald. SystemMaxFileSize= controls how big each file grows before rotation, so smaller files mean finer-grained eviction. Raise SystemMaxUse= only if the filesystem can afford it, because SystemKeepFree= still wins on a small partition. The journalctl(1) man page covers the vacuum and rotate options below.

Vacuuming manually without breaking an investigation

sudo journalctl --vacuum-size=500M
sudo journalctl --vacuum-time=2weeks
sudo journalctl --vacuum-files=5

Each command removes archived files until the condition holds. journalctl --rotate archives the active file first, so its contents become eligible too.

Warning: Vacuuming is irreversible. During an incident, copy first: journalctl --since "2025-01-10 02:00" --until "2025-01-10 04:00" -o export > incident.export, or cp the files from /var/log/journal/.

The logs are there but you cannot see them

Group membership: systemd-journal, adm and wheel

A non-root user sees only their own entries. Some versions print "Hint: You are currently not seeing messages from other users and the system." Check your groups:

id
sudo usermod -aG systemd-journal alice

Members of systemd-journal can read everything. On many distributions adm or wheel also work. Group changes need a new login session.

Filters that quietly hide entries

  • -u foo matches the unit name only. A process that moved to another cgroup or unit logs elsewhere. List real names with journalctl -F _SYSTEMD_UNIT, then try _SYSTEMD_UNIT=, SYSLOG_IDENTIFIER= or _COMM=.
  • -p err shows err and more severe only, so warnings vanish.
  • --since without a timezone uses local time, which misleads on UTC servers.
  • -b means the current boot. Use -b -1 for the previous one, and -k for kernel messages.

If filters are clean, run journalctl --verify. journald renames corrupted files with a ~ suffix and starts a fresh one, so the damaged file may sit in the directory yet go unread.

Journal has it, /var/log/syslog does not: rsyslog forwarding

Which input path is your rsyslog using?

rsyslog gets journald data in one of two ways. With imuxsock, it reads the socket /run/systemd/journal/syslog, and journald only writes to that socket when ForwardToSyslog=yes is set. Upstream defaults to no, but some distribution packages enable it. With imjournal, rsyslog reads the journal directly, which is the RHEL-family default. It tracks its position in a StateFile.

grep -R 'imjournal\|imuxsock' /etc/rsyslog.conf /etc/rsyslog.d
sudo rsyslogd -N1
systemctl status rsyslog
systemd-analyze cat-config systemd/journald.conf | grep -i ForwardToSyslog

rsyslogd -N1 validates the config without starting anything, so run it before every restart. If the grep shows imuxsock and ForwardToSyslog is unset or no, that is your gap.

Also check the selectors. A rule like authpriv.* /var/log/secure matches on facility. Lines that a service writes to stdout enter the journal as facility daemon, so they never reach an authpriv file even if the content looks auth-related.

Rate limits and queues on the rsyslog side

Both inputs have their own limiter, independent of journald. A burst can pass journald intact and still be thinned out in rsyslog. For imjournal, set it on the module load:

module(load="imjournal"
       StateFile="imjournal.state"
       Ratelimit.Interval="0")

Alternatively, keep the interval and raise Ratelimit.Burst. The documented defaults are 600 seconds and 20000 messages, but confirm them for your version. Look for an "imjournal: N messages lost due to rate-limiting" line in rsyslog's own output. For imuxsock, the legacy equivalents are SysSock.RateLimit.Interval and SysSock.RateLimit.Burst. The rsyslog documentation lists the parameters per module.

Forwarding to a remote host with omfwd is a separate failure domain. If local files are complete but the central server has gaps, look at the action's queue (queue.type="LinkedList", queue.filename, action.resumeRetryCount="-1") before touching journald.

Prove the fix with a controlled test

Send a marker line through every path

Emit one line via the syslog API and one via stdout capture, then look in both places:

logger -t logtest -p user.notice 'marker 1'
systemd-cat -t logtest -p warning echo 'marker 2'
journalctl -t logtest -n 5
grep logtest /var/log/syslog    # /var/log/messages on RHEL family

Both markers should appear in the journal. If marker 1 reaches the file but marker 2 does not, suspect a facility or priority selector. If neither does, go back to the input path. After a reboot, journalctl --list-boots should show the previous boot as a negative index above the current one, and journalctl -b -1 -t logtest should return the markers.

Reproduce a burst to confirm rate limits

Use a non-production host, or accept the noise. Lowering the limit temporarily makes the test cheap:

printf '[Journal]\nRateLimitBurst=1000\n' | sudo tee /etc/systemd/journald.conf.d/99-test.conf
sudo systemctl restart systemd-journald
seq 1 20000 | logger -t burst
journalctl -t burst | wc -l
journalctl -t systemd-journald --since "-5min" | grep -i suppressed

The count should land well below 20000, with a suppression line naming the number dropped. Run the same test against your real settings and the count and the suppressed total should add up to what you sent. Then delete 99-test.conf and restart journald again.

Shipping the journal off-host so reboots and vacuums stop mattering

Everything above tunes how long a single machine remembers. That is a buffer, not an archive. A vacuum, a corrupted file, a reimaged VM or a dead disk all end the same way, so any log you might need after an incident should also exist on another host.

Native shipping with systemd-journal-upload

The systemd-journal-remote package (the name is the same on Debian-family and RHEL-family systems) provides both ends. The sender reads the journal and pushes it over HTTP(S) in the journal export format, so all structured fields survive. On the sender, set the target in /etc/systemd/journal-upload.conf:

[Upload]
URL=https://loghost.example.com:19532
ServerKeyFile=/etc/ssl/private/journal-upload.pem
ServerCertificateFile=/etc/ssl/certs/journal-upload.pem
TrustedCertificateFile=/etc/ssl/certs/ca.pem
sudo systemctl enable --now systemd-journal-upload
# on the receiver
sudo systemctl enable --now systemd-journal-remote.socket
journalctl -D /var/log/journal/remote -n 5

The receiver writes one file per sending host under /var/log/journal/remote/. Run systemctl cat systemd-journal-remote.service to see whether your distribution's unit listens on HTTP or HTTPS, and do not use plain HTTP across an untrusted network. The uploader remembers its position in a state file, so it resumes after a reboot instead of resending everything. See systemd-journal-upload(8) for the full option list.

Forwarding with rsyslog omfwd

If rsyslog already reads the journal through imjournal, adding a forwarding action is a small change. The disk-assisted queue is what keeps messages during a network outage:

action(type="omfwd" target="loghost.example.com" port="6514" protocol="tcp"
       StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name"
       queue.type="LinkedList" queue.filename="fwd_loghost"
       queue.maxDiskSpace="1g" queue.saveOnShutdown="on"
       action.resumeRetryCount="-1")

TLS needs the rsyslog-gnutls package (or the equivalent for your distribution). The trade-off is that classic syslog framing flattens the journal's fields. If you need _SYSTEMD_UNIT or PRIORITY on the other side, use a JSON template or mmjsonparse-style handling, otherwise you will only have the message text.

Loki with a journal reader

Promtail can read the journal directly and attach fields as labels, with no rsyslog in the path. Grafana's newer collector, Alloy, has an equivalent journal source. Check which one your Loki deployment uses.

scrape_configs:
  - job_name: journal
    journal:
      path: /var/log/journal
      max_age: 12h
      labels:
        job: systemd-journal
    relabel_configs:
      - source_labels: ['__journal__systemd_unit']
        target_label: unit

Promtail needs read access to the journal, so add its user to systemd-journal. Its positions file prevents duplicates after a restart. max_age only limits how far back it reads when it has no saved position. The same shipping pattern applies if the destination is an ELK stack or any other collector.

Check the copy, not the config

Run the marker test from the previous section, then confirm the line on the central side. After that, stop the sender for a few minutes, log some lines, restart it and confirm the gap fills in. Only then should you shrink SystemMaxUse= on the host and treat local retention as a short buffer. The Linux Log Management and Analysis eBook covers retention planning for the central side.

Missing-log triage checklist

Work through these in order and stop at the first hit:

  1. Never stored: ls -ld /var/log/journal and journalctl --list-boots. Set Storage=persistent, then journalctl --flush.
  2. Suppressed: journalctl -t systemd-journald | grep -i suppressed. Raise LogRateLimitBurst= on the unit, then fix the flood.
  3. Rotated away: journalctl --disk-usage against SystemMaxUse= and SystemKeepFree=. Export before any --vacuum-*.
  4. Not visible: id for systemd-journal membership, then remove -u, -p and -b filters. Run journalctl --verify.
  5. Not forwarded: rsyslogd -N1, check ForwardToSyslog or imjournal, then the rsyslog rate limits and selectors.
  6. Verify: marker lines, a reboot, and a burst test.

Commit the fixes as drop-ins under /etc/systemd/journald.conf.d/ and /etc/rsyslog.d/ so they survive package updates. For the next step, shipping logs off the host so a dead disk cannot take the evidence with it, see Linux Log Management & Centralized Logging.

Frequently Asked Questions

Why does journalctl --list-boots show only one boot?

Usually the journal is volatile: only /run/log/journal exists, so each reboot wipes it. Set Storage=persistent and restart journald. It can also be vacuuming that removed older boots, or a host that has genuinely only booted once since the journal was created.

Is it safe to set RateLimitIntervalSec=0 in journald.conf?

It is safe on a healthy host, but it removes your protection against floods. A crash-looping or debug-logging service can then fill the journal's size limit quickly, evicting older history and costing CPU. Prefer a per-unit LogRateLimitBurst= override and fix the noisy service.

How much disk space should I give the journal?

Size it by the history you need, not a fixed number. Measure how fast it grows with journalctl --disk-usage a day apart, then set SystemMaxUse= to cover your retention target. Keep SystemKeepFree= in mind, since it wins on small partitions.

Do I still need rsyslog if journald is persistent?

Not for local reading. Persistent journald with sensible limits covers that. You still want rsyslog, or another shipper, to forward logs to a central server, feed tools that expect plain text files, or keep logs after the host disk is lost. Many setups run both.

How do I recover logs from a journal directory copied off a dead server?

Point journalctl at the copy: journalctl -D /path/to/copy/journal or --directory=. Use --file= for individual files. Add --verify first, since damaged files may only be partly readable. The machine-ID subdirectory does not need to match the current host.

Share this article:
Mikkel Sorensen
About the Author

Mikkel Sorensen

UX/UI Design, Java Development, User-Centered Application Design, Technical Documentation

Mikkel Sรธrensen is a UX/UI-focused software developer with a strong background in Java-based application development.

He works at the intersection of user experience design and software engineering, creating applications that are both technically robust and user-centered. His experience includes interface design, inter...

UX Design UI Design Java Applications User Experience Engineering Accessibility Basics

Stay Updated

Subscribe to our newsletter for the latest tutorials, tips, and exclusive offers.