Journald and text logs
Quick answer
Logs record events that help explain what a system did. Start with a narrow time interval, relevant service and severity; avoid collecting unrelated or private data. A text log and a systemd journal are different storage formats.
Prepare the practice environment
Run python3 lab-fixtures/logs-time/setup.py from the extracted package root as an ordinary user. Enter the printed path and check pwd. Use a fresh fixture and Bash with LC_ALL=C and set -o pipefail for each example. Never install the sample schedules, change system time or use the global logrotate configuration. Manual inspection requires an authorized disposable VM.
How it works
journald stores structured records with fields such as unit and priority. journalctl can select the current boot (-b), unit (-u), time range (--since/--until) and severity (-p warning selects warning and more severe levels). Text logs may instead be managed by an application or syslog daemon. dmesg reads the kernel ring buffer, which is finite and may be restricted. A missing record can mean rotation, insufficient permissions, filtering or no recorded event. Correlate timestamps before inferring causes. The provided pipe-delimited file is a synthetic transcript, not a binary journal.
A severity filter can hide a useful informational message immediately before an error. Start with the affected unit and a narrow time interval, then adjust severity only if needed. Preserve the original records and note the boot and timezone used for the search. With the synthetic transcript, filtering columns is a text-processing exercise; it does not demonstrate access to the real journal.
Try the examples
awk -F'|' '$2=="bm-report.service" && $3<=4 {print $4}' journal.txtField 3 is numeric severity; smaller numbers are more severe.
Expected stdout:
retry scheduledwrite failedThe anchor excludes messages that merely contain ERROR later in the line.
Expected stdout:
2journalctl -b -u bm-report.service -p warning -n 20 --no-pagerOnly in an authorized systemd VM; results depend on records and permissions. Review and redact sensitive fields before sharing.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Do not assume every log is in /var/log, or use dmesg --clear to troubleshoot. Never paste full production logs into public channels.
Practice
From journal.txt, select only bm-report.service events with priority 4 or smaller; explain why the result alone does not establish a root cause.
Related references
Study: journalctl, dmesg. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Journald and text logs — Knowledge Check
Apply log, clock and scheduling concepts to private fixtures and VM-only scenarios.
Which source is structured?
What does -p warning include?
What does an empty filtered result prove?
Before sharing logs, what should you do?