Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Logging

Direct answer

Linux logging has two main paths: systemd-journald collects kernel, service and syslog messages in a binary journal, and rsyslog (or syslog-ng) writes text files under /var/log and can forward messages to a central server.

When to use this

Use it as the entry point to find the logs for a problem, or to set up central logging.

First 30 seconds

1. journalctl -b -p err — errors this boot.

2. Service: journalctl -u <svc> --since '10 min ago'.

3. App logs: ls -lt /var/log | head.

4. Persistent journal? ls /var/log/journal.

5. Central forwarding configured and reachable?

Operational verification

event → written to the journal (and/or syslog) → stored locally → rotated → forwarded centrally

Evidence · next step

For Logging, continue with the first unproven Topic check: Pin event time, timezone/clock source, host, boot ID, service/unit, PID and workload transaction. If that boundary is healthy, advance to the adjacent check: Identify the producer and effective logging path: journal/stdout-stderr, syslog socket, kernel ring, or application file. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commandjournalctl
Scope / prerequisiteUse it as the entry point to find the logs for a problem, or to set up central logging.
Verify · 1
What next?3 suggested next steps
Child topics (this level)6
Catalog command links1
Evidence1
On this pageJump to a specific section
Linux command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

event/workload → producer/process/kernel → logging API/socket/stdout/file → journald/syslog collector → local persistence/index → rotation/retention → forwarding/remote receipt → query/filter → correlation → original workload verification

Healthy evidence: the exact event is captured with correct host/time/source identity, reaches the intended collector and storage/forwarder, survives retention policy, and can be queried and correlated with the original workload.

Step 2 Commands Verify boundary
journalctl -p warning -b
journalctl -u sshd --since '1 hour ago'
tail -f /var/log/syslog
ls -lh /var/log
Step 3 Verification and output interpretation Verify boundary

Verification path. Query the same boot/unit/PID/time window as the event and record clock state before correlating multiple hosts. Confirm producer emission when possible, local admission/rate limiting, storage persistence, forwarder queue/transport and collector ingestion. For rotated file logs, show which inode the daemon currently writes. Missing log output is evidence only after the complete collection path and filter/retention policy are accounted for.

Existing fast checks for this Topic. - Pin event time, timezone/clock source, host, boot ID, service/unit, PID and workload transaction.

  • Identify the producer and effective logging path: journal/stdout-stderr, syslog socket, kernel ring, or application file.
  • Verify collection, persistence, rotation/retention and forwarding independently before changing configuration.
  • Repeat the original workload and correlate its result with fresh log evidence at the same timestamp.

Verification chain. event/workload → producer/process/kernel → logging API/socket/stdout/file → journald/syslog collector → local persistence/index → rotation/retention → forwarding/remote receipt → query/filter → correlation → original workload verification

Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: timestamps are ambiguous, only one collector layer is checked, absence is treated as evidence, rotated boots/files are ignored, or a generic error line is declared causal without correlation.

It does not show behavior outside the captured producer, collection, persistence, retention, forwarding, query or workload scope. Logging evidence is trustworthy only for the producer, time window, collection path, retained data and query scope that were actually verified, but it does not show causation or end-to-end service health.

Next check: Continue from the first step that has not been verified: reproduce one exact event, align clock/boot/source identity, trace it through collection and storage, then verify retention/forwarding/query scope and independently repeat the original workload.

Step 5 Common mistakes Narrow the fault
  • Logs filling /var.
  • Journal not persistent (lost on reboot).
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Drill down

Subtopics

Go one level deeper into this subject.

Subtopic systemd-journald

systemd-journald collects structured and text records from services, stdout/stderr, the native journal API, syslog compatibility and kernel sources, annotating them with metadata such as unit, PID, boot and priority before storing or forwarding according to effective journald policy.

Subtopic rsyslog

rsyslog is a configurable syslog processing engine that receives messages, parses properties, applies rulesets/selectors/templates, writes files or queues and forwards events to remote destinations; success requires proving the message traversed the intended ruleset and output action.

Subtopic syslog

Syslog is the message model and transport convention behind many Linux logs: messages carry priority derived from facility and severity plus header/application metadata, then traverse local sockets or network transports to a collector whose parsing and retention must be verified separately.

Subtopic /var/log

`/var/log` is the conventional filesystem namespace for persistent text and application logs, but its contents are distribution- and service-dependent and may coexist with or be absent in journal-centric systems; file presence, inode identity, ownership, rotation and open-file state matter when proving what is actually being written.

Subtopic logrotate

logrotate manages retention of file-based logs by selecting files on schedule/size, renaming or copying, compressing and removing generations, then optionally signaling/reopening the writer; rotation is complete only when the application continues writing to the intended new log without data loss.

Subtopic Log Troubleshooting

Linux log troubleshooting should isolate the first failed evidence boundary: event generation, timestamping, local collection, filtering/rate limiting, persistence, rotation/retention, forwarding, remote ingestion or query scope. The objective is not merely to find an error string but to establish whether logging itself is complete enough to support the operational conclusion.

Key points

Start with journalctl for services and the kernel; use /var/log files for applications that write their own logs. Make the journal persistent (/var/log/journal) to keep logs across reboots. Forward to a central server for security and correlation.

Key checks
  • journalctl -b -p warning — warnings and errors since boot
  • journalctl -u <unit> -f — follow one unit's log
  • ls -lh /var/log — log files and sizes
  • logger -p user.info test — send a test message
ReferenceWhat it is1 section · depth on demand

Core model

Start from the exact event and clock context. Identify the producer and logging API/path, then verify receipt by journald/syslog, storage or forwarding, retention/rotation, and the exact query used. Correlate logging evidence with process, service, kernel and workload state instead of assuming that a log message is the root cause.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

Logging evidence is trustworthy only for the producer, time window, collection path, retained data and query scope that were actually verified, but it does not show causation or end-to-end service health.

In depth

Finding things in Linux logs quickly

On modern Linux, most logs end up in the systemd journal, and rsyslog often writes text copies under /var/log. The journalctl(1) manual page describes the filters that make the journal fast to search:

  • -u selects a unit, and -b a boot (-b -1 is the previous one).
  • -p selects a priority and everything more severe.
  • --since and --until accept dates, yesterday/today, or relative times.
  • -g searches messages with a regular expression.
  • -k shows kernel messages only.
  • Field matches such as _PID= or _COMM= narrow it down further.

Questions and commands

QuestionCommand
Why did this service fail?journalctl -u nginx -b -n 50
What went wrong during the last boot?journalctl -b -1 -p err
What happened around 14:00?journalctl --since "14:00" --until "14:10"
Live view of one servicejournalctl -fu report-api
Kernel messages (disks, NICs, OOM)journalctl -k -b, dmesg -T
Logins and sudojournalctl _COMM=sshd _COMM=sudo --since today
A message anywherejournalctl -b -g "connection refused"
Text logs (Debian / RHEL)/var/log/syslog, /var/log/messages, /var/log/auth.log, /var/log/secure

Correlating events

PracticeWhy
Synchronised clocks (NTP) on every hostTimestamps across systems line up
-o short-iso or short-preciseUnambiguous timestamps with a time zone
Central loggingEvents survive the host, and can be compared
Note the boot ID--list-boots shows when restarts happened
host$ journalctl -u nginx -b -p warning --no-pager | tail -3
host$ journalctl -b -1 -p err --no-pager | head
kernel: nvme nvme0: I/O 412 QID 3 timeout, aborting
systemd[1]: Failed to start report-api.service - Report API.
host$ journalctl -k -b -g "Out of memory|oom-kill" --no-pager
host$ journalctl --since "2026-11-28 13:55" --until "2026-11-28 14:05" -o short-iso --no-pager | wc -l
host$ journalctl _SYSTEMD_UNIT=sshd.service -g "Failed password" --since today | wc -l
host$ sudo tail -f /var/log/syslog

Start wide, then narrow

When the cause is unknown, journalctl -b -p err over the relevant time window shows all errors from every service. That often reveals a root cause outside the service being investigated, such as storage timeouts or OOM kills.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Runtime state ownership and mechanics. Linux logging is a pipeline from kernel/application producers through journald and/or syslog daemons into volatile or persistent stores, forwarding targets and rotation/retention policy. The journal is indexed by boot, unit, PID and structured fields; text files under /var/log are distribution/service dependent. Rate limits, storage mode, namespace/container boundaries and forwarding filters can all change what is retained even when an event was emitted.

Topic-specific state model. Linux logging is an evidence pipeline, not a single file: producers emit records to the journal, syslog socket, stderr/stdout or application files; collectors persist, route, rotate and forward them; investigators must show timestamp, source, transport, persistence, retention and query scope before treating absence or presence as causal evidence.

Technical metadata. Host/distribution/systemd/rsyslog versions, boot ID, monotonic/realtime timestamp and timezone, NTP/clock state where relevant, producer binary/service/unit/PID/UID, logging transport/API, journal transport/facility/severity/priority, syslog source/destination/transport, file path/device/inode/ownership/permissions, journald storage/rate limits/retention, rsyslog input/ruleset/action/queue, logrotate rule/state/inode handoff, forwarding destination/receiver status, query filters, correlation ID/request ID and original workload result.

Interpretation rule. - Log line present ≠ log line is the root cause.

  • No matching log line ≠ event did not occur unless collection, retention and query coverage are confirmed.
  • Service active ≠ its logs are being persisted, retained or forwarded as intended.
  • A healthy local journal ≠ remote syslog/SIEM delivery or workload health is confirmed.

Quick reference

Linux logging pipeline: services write to stdout/stderr or syslog → journald collects (binary, indexed) → optionally forwards to rsyslog → files in /var/log and/or remote collectors (SIEM, Loki, Elastic).

journalctl --disk-usage
systemctl status systemd-journald rsyslog
ls -lh /var/log
logger -p user.warning -t test 'hello from logger'

Decide per environment: journald only (persistent storage, forwarding via systemd-journal-upload or agents) or journald + rsyslog for traditional files and syslog forwarding.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. Logging evidence is trustworthy only for the producer, time window, collection path, retained data and query scope that were actually verified, but it does not show causation or end-to-end service health.

Model. A log line is evidence that software reported something, not automatic root cause. Absence of a line is not evidence an event never occurred. Journal vacuum/rotation can remove historical context, and container logging drivers may redirect output away from host files. Unsynchronized clocks distort cross-host sequence. “No errors in logs” is weaker than a successful service transaction plus relevant state/counter evidence.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Configuration intent and lifecycle. Decide which component owns retention and forwarding before changing both journald and rsyslog rules. Persistent journal storage depends on configuration and filesystem availability. File logs may be created/rotated by logrotate, the application itself or a logging daemon. Rotation policy must match daemon reopen behavior. Central forwarding should preserve timestamps/host identity and tolerate transport/collector failures according to the required reliability model.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Logging. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://systemd.io/ · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux loggingjournal syslog logslinux log pipelinelog evidence
Embedded reference data

Quick lookup tables

Logging operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Logging.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateLinux logging is an evidence pipeline, not a single file: producers emit records to the journal, syslog socket, stderr/stdout or application files; collectors persist, route, rotate and forward them; investigators must prove timestamp, source, transport, persistence, retention and query scope before treating absence or presence as causal evidence.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + boot ID + clock/timezone + event → identify producer/process → identify logging API/socket/file → verify collector receipt → inspect filtering/rate-limit → prove persistence/inode → verify rotation/retention → verify forwarding/remote receipt if required → query exact time/source → correlate with original workload.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainevent/workload → producer/process/kernel → logging API/socket/stdout/file → journald/syslog collector → local persistence/index → rotation/retention → forwarding/remote receipt → query/filter → correlation → original workload verificationTrace requested/configured state through effective state to the observed workload result.
Failure boundaryLogging evidence is trustworthy only for the producer, time window, collection path, retained data and query scope that were actually verified; it does not independently prove causation or end-to-end service health.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux logging evidence can establish this proof path: event/workload → producer/process/kernel → logging API/socket/stdout/file → journald/syslog collector → local persistence/index → rotation/retention → forwarding/remote receipt → query/filter → correlation → original workload verificationUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured producer, collection, persistence, retention, forwarding, query or workload scope. Logging evidence is trustworthy only for the producer, time window, collection path, retained data and query scope that were actually verified; it does not independently prove causation or end-to-end service health.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: reproduce one exact event, align clock/boot/source identity, trace it through collection and storage, then verify retention/forwarding/query scope and independently repeat the original workload.Continue to the next unresolved boundary while preserving the original test condition.

Logging · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryLogging
Topic pathLogging
Runtime stateLinux logging is an evidence pipeline, not a single file: producers emit records to the journal, syslog socket, stderr/stdout or application files; collectors persist, route, rotate and forward them; investigators must prove timestamp, source, transport, persistence, retention and query scope before treating absence or presence as causal evidence.
Fast checks- Pin event time, timezone/clock source, host, boot ID, service/unit, PID and workload transaction. - Identify the producer and effective logging path: journal/stdout-stderr, syslog socket, kernel ring, or application file. - Verify collection, persistence, rotation/retention and forwarding independently before changing configuration. - Repeat the original workload and correlate its result with fresh log evidence at the same timestamp.
Verification chainevent/workload → producer/process/kernel → logging API/socket/stdout/file → journald/syslog collector → local persistence/index → rotation/retention → forwarding/remote receipt → query/filter → correlation → original workload verification Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryLogging evidence is trustworthy only for the producer, time window, collection path, retained data and query scope that were actually verified; it does not independently prove causation or end-to-end service health. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?