Begin with a journal you can inspect safely
A service status says where it stands; the journal can explain how it got there. Journald stores entries in journal files, with a message and structured fields such as boot ID, priority, and originating unit. Journalctl selects readable files, filters entries, and formats the result. Without options it starts with the oldest accessible entry. We will use one supplied native journal with exactly seven synthetic entries, then translate the questions to a live host.
The clitdj-demo.service units in Monday's systemd map and Tuesday's systemctl walkthrough were offline fixtures, not installed services. A unit is the manager's named resource; systemctl separates its runtime state, loaded definition, and installation policy. This journal is a different teaching fixture. Its messages, timestamps, boot IDs, PIDs, and even fields normally added by journald were manufactured. They demonstrate file reading and query semantics, not daemon-attested events. It contains no real logs or secrets.
Use one Bash 5.2.21 shell and journalctl from systemd 255 (the installed Ubuntu build is 255.4-1ubuntu8.17). The setup creates a private directory under /tmp. Mktemp -d creates that directory by replacing the six X characters; $(...) stores its path in clitdj_lab. Curl downloads the compressed fixture: --fail rejects HTTP errors, --location follows redirects, --silent hides progress, --show-error retains errors, and --output names the file. Double quotes keep a pathname one argument. Each && continues only after success.
Printf puts a known SHA256 and filename in the two-space form sha256sum --check expects. The pipe passes that line to sha256sum, whose --status suppresses a successful report; - means read the check line from standard input. Gzip -d decompresses, -c sends bytes to standard output, and the shell's > writes them to the private file. We check both compressed and decompressed bytes before using the file. The assignments then save its pathname and the newer fixture boot ID. Export TZ=UTC makes later time input and display deterministic in this shell; it does not set the system clock. --file reads only this native file, and --verify checks internal consistency, not the truth of the manufactured metadata. Do not continue if a step fails.
clitdj_lab=$(mktemp -d /tmp/clitdj-journalctl.XXXXXX) &&
curl --fail --location --silent --show-error --output "$clitdj_lab/journalctl-demo.journal.gz" https://clitdj.com/fixtures/journalctl-demo.journal.gz &&
printf '%s %s\n' 833992c7d1f2dfad07a298e99f68b5903354e5fe3d64c535a99055a933ae5b25 "$clitdj_lab/journalctl-demo.journal.gz" | sha256sum --check --status - &&
gzip -dc "$clitdj_lab/journalctl-demo.journal.gz" > "$clitdj_lab/journalctl-demo.journal" &&
printf '%s %s\n' 687657432f5826d876e5e17bdd977a8160e0b934016b060b96bb77acdcb7c24b "$clitdj_lab/journalctl-demo.journal" | sha256sum --check --status - &&
clitdj_file="$clitdj_lab/journalctl-demo.journal" &&
clitdj_boot=c9dc437c3fb54343b5e92d6ff4731438 &&
export TZ=UTC &&
journalctl --file="$clitdj_file" --verifySuccessful verification prints PASS: followed by the run-specific pathname. The compressed SHA256 is 833992c7d1f2dfad07a298e99f68b5903354e5fe3d64c535a99055a933ae5b25; the decompressed SHA256 is 687657432f5826d876e5e17bdd977a8160e0b934016b060b96bb77acdcb7c24b. The setup leaves those two files in the private directory and variables plus TZ in this Bash shell. Keep this shell for later blocks. If the fixture route is unavailable, stop; do not substitute real host logs.
Ask for one unit in one recorded boot
Now ask what the fixture records about clitdj-demo.service in its newer boot. Test -f checks that the setup's file exists; && skips the query if it does not. All later fixture blocks use that guard. --file confines the read to the downloaded file. -b followed by clitdj_boot selects its exact _BOOT_ID. Use the explicit ID so the query does not depend on how journalctl resolves an empty boot argument. For the normal host journal, bare -b selects the current boot. With an alternate source whose history does not contain the host's current boot, bare -b can instead resolve to that source's last retained boot. -u includes entries from and about the named unit, including a manager-about-unit entry. --no-pager prints directly rather than opening a pager. -o cat prints only each MESSAGE, without timestamps or fields.
These five exact messages are synthetic. On a live systemd host, omit --file, use bare -b for the current boot, and replace the name with an existing authorized service. Its result is variable. The journalctl 255 manual documents -u's wider from-and-about selection.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service -o catbefore
start boundary
manager about unit
end boundary
afterThe live equivalent is journalctl --no-pager -b -u ACTUAL.service -n 20. Replace ACTUAL.service with an installed service you may inspect. -n 20 limits displayed recent entries, not stored history. An empty live result may reflect unit choice, permissions, boot, retention, or no entries; it does not prove success.
Identify the boot before using an offset
--list-boots reports boot IDs and first/last retained message times. This file has an older synthetic boot ID 01000000000000000000000000000000 with one message and the newer ID saved in clitdj_boot. Query the older ID explicitly for an exact identity.
In journalctl 255, -b -1 means the boot before the last retained visible boot, normally the previous boot if current-boot messages are present. It is not unconditionally the boot before your current boot. Offsets skip boots with no accessible retained entries. On a live host, omit --file, inspect --list-boots, and use a displayed ID when exact identity matters. Missing history is not a clean-history finding.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager --list-boots &&
journalctl --file="$clitdj_file" --no-pager -b 01000000000000000000000000000000 -o catThe list shows two IDs: November 1, 2026, 08:00:00 UTC for the older boot and November 2, 2026, 08:59:59 through 10:00:00 UTC for the newer one. The last line is exactly old boot. These timestamps describe retained messages, not full uptime.
Bound the incident in time
The synthetic incident window runs from November 2, 2026, 09:00:00 through 10:00:00 UTC. --since includes entries at or newer than its bound; --until includes entries at or older than its bound. Single quotes pass each date-time as one Bash argument; journalctl parses it using the UTC timezone set during setup. The first output is exactly on the start boundary and the last is exactly on the end boundary. The before and after messages fall outside.
On a live host, omit --file, choose the boot and actual unit, and use bounds in a known timezone. --utc changes timestamp display, not how an otherwise local-time input is interpreted. Include full dates across midnight and record the host timezone when sharing a timeline. Journalctl 255 defines the inclusive bounds.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service --since='2026-11-02 09:00:00' --until='2026-11-02 10:00:00' -o catstart boundary
manager about unit
end boundaryThe file, boot, unit, and time constraints all apply. No fixed live-host transcript is implied.
Use priority as metadata, not a word search
-p warning selects warning level 4 and more severe numeric levels 0 through 3. It does not search the MESSAGE text for the word warning. In the fixture it selects start boundary at level 4 and end boundary at level 3. An inclusive range -p err..err selects only level 3, yielding end boundary. PRIORITY is the entry field; systemd.journal-fields 255 defines it, and journalctl 255 defines the threshold and range rules.
An application can fail without emitting a warning-priority entry. This query narrows visible evidence, not the underlying event. Live-host results remain variable.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service -p warning -o cat &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service -p err..err -o catstart boundary
end boundary
end boundaryThe first two lines are from warning-or-higher; the last line is the exact err-level result. Omit --file and substitute your actual unit and boot on a live host.
Inspect fields, then combine exact matches
The compact view hides fields. -o verbose shows them: the fixture's before entry has _SYSTEMD_UNIT=clitdj-demo.service, _PID=1234, PRIORITY=6, and MESSAGE=before. The manager about unit entry instead has UNIT=clitdj-demo.service. Those fields were manufactured for this file. In a genuine journal, a leading-underscore field is called trusted because journald adds it instead of accepting that named field directly from client code. Trusted does not certify that the message text is true. With standard-output/error stream logging, a child can inherit a connection opened for a parent, so metadata may still describe that original connection rather than the later writer. Non-underscore application fields lack the same validation. This is documented in systemd.journal-fields 255 and systemd-journald.service 255.
Journalctl interprets raw FIELD=value operands; Bash merely passes them. Different fields are ANDed: the first query requires both demo origin and PID 1234. Repeating the same field makes alternatives: _PID=1234 _PID=5678 means either PID, still within other constraints. A standalone + separates OR groups; it is a separate journalctl argument, not shell arithmetic or a pipe. The second query selects that demo-origin/PID group OR entries originating from the preparation unit. The journalctl 255 match examples document these rules.
On a live host, inspect real fields first, then replace both illustrative unit names with real authorized units and PID 1234 with an observed value. The earlier offline fixtures installed neither unit. Raw _SYSTEMD_UNIT= is narrower than -u, which can include manager and coredump messages about a unit. Keep boot and time context: PIDs can be reused.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" _SYSTEMD_UNIT=clitdj-demo.service _PID=1234 -o cat &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" _SYSTEMD_UNIT=clitdj-demo.service _PID=1234 + _SYSTEMD_UNIT=clitdj-demo-prepare.service -o catbefore
start boundary
before
start boundary
preparationThe first two lines are the AND result; the last three are the OR result. To see a small structured sample, add -n +2 -o verbose to the earlier file/boot/unit query. -n +2 selects the two oldest matches, unlike recent-tail -n 2. The displayed provenance in this fixture is manufactured, not daemon-attested.
Choose output without losing context
-o short-iso-precise gives compact lines with ISO-style timestamps at microsecond precision; the first timestamp in this UTC window is 2026-11-02T09:00:00.000000+00:00. -o json emits one JSON object per entry with structured fields. Some field values can be arrays or null, so downstream code should not assume every value is a scalar string. -o cat, used above, emits only MESSAGE and drops timestamp and field context from the display. The journalctl 255 output-mode definitions explain these presentation choices.
Use one output mode at a time with the same bounded selection. On a live host, omit --file and use an actual boot, unit, and interval. Broad exports can reveal application tokens, paths, or personal data. --no-pager is not redaction.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service --since='2026-11-02 09:00:00' --until='2026-11-02 10:00:00' -o short-iso-precise &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service --since='2026-11-02 09:00:00' --until='2026-11-02 10:00:00' -o jsonThe first query prints three timestamped lines; the second prints three newline-delimited JSON objects for start boundary, manager about unit, and end boundary. Both read the same file without changing it.
Resume after an entry, or follow deliberately
A cursor is an opaque address for an entry, not a date to parse. -n +2 chooses the two oldest demo-unit matches, before and start boundary; --show-cursor prints the last displayed entry's cursor. The next query uses that exact synthetic cursor with --after-cursor, so it starts at manager about unit. --cursor would include the addressed start boundary. The cursor's private format belongs to this fixture; pass it whole. Single quotes protect its semicolons from Bash.
--cursor-file=/path/to/private.cursor can read a stored cursor, start after it, and update that file with the last cursor. This changes the named file: protect it, and bound a batch query before automation. A cursor does not ensure archived entries remain retained. Journalctl 255 documents these contracts.
For a live watch, journalctl --no-pager -b -u ACTUAL.service -n 20 -f follows new entries after an initial recent tail; replace the unit name. -f stays open until interrupted, usually with Ctrl-C. -n 20 limits only the initial display, not future records. --no-tail would print all stored matches before following. No live daemon follower was run for this article. Avoid unbounded broad follows without an access, duration, and storage plan.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service -n +2 -o cat --show-cursor &&
journalctl --file="$clitdj_file" --no-pager -b "$clitdj_boot" -u clitdj-demo.service --after-cursor='s=9dbec67b7eeb4bfaa3970a7359056f55;i=3;b=c9dc437c3fb54343b5e92d6ff4731438;m=1e8480;t=65f475eea6400;x=3a48ebd7ad915a8f' -o catbefore
start boundary
-- cursor: s=9dbec67b7eeb4bfaa3970a7359056f55;i=3;b=c9dc437c3fb54343b5e92d6ff4731438;m=1e8480;t=65f475eea6400;x=3a48ebd7ad915a8f
manager about unit
end boundary
afterThe first query prints two entries and the cursor; the second begins strictly after it. No cursor file or journal file is written by these queries.
What determines when the journal begins?
Some older or debug displays say “Journal begins at”; the named systemd 255 build normally suppresses that banner. The underlying point is the earliest entry in files this invocation can read, not the machine's installation date or necessarily its first boot. When shown, the banner describes available files even if a later filter selects newer entries. --list-boots shows first and last retained message times per visible boot. --disk-usage includes active and archived files, not only bytes a vacuum could reclaim. Both are documented in journalctl 255.
On a live host, available history depends on files, persistence, retention, boot availability, namespaces, and account access. Journald.conf 255 documents Storage=auto for the default namespace: persistent /var/log/journal if the directory exists, otherwise volatile /run/log/journal. Storage=persistent prefers /var, with a /run fallback during early boot or disk unavailability. Storage=volatile uses /run. Storage=none discards newly received records instead of storing them, though forwarding may still occur; switching to none does not itself erase old files. The boot flush service normally moves early volatile data to persistent storage when enabled. Volatile history disappears on reboot. Size/file limits and optional MaxRetentionSec can remove archived history; rate limiting can mean events were never stored.
Logrotate does not reset native journal begin time. It normally manages separate text logs, whereas journald manages its own .journal-file rotation and retention. Journalctl interleaves still-available active and archived files. Rotation alone archives rather than deletes; vacuuming or retention can remove old archived files and advance the earliest readable entry. Separately forwarded syslog text logs may have a logrotate lifecycle, but it does not set the native journal's history. This follows journalctl 255, journald.conf 255, and systemd-journald.service 255.
test -f "$clitdj_file" &&
journalctl --file="$clitdj_file" --no-pager --list-boots &&
journalctl --file="$clitdj_file" --no-pager --disk-usageThe boot list shows the two manufactured boot spans. The native file's disk report is about 8.0M, much larger than its seven messages. Both commands only read. On a live host, omit --file and expect variable dates and usage; a quiet query over one visible scope cannot prove an event never occurred.
Rotation is not deletion; vacuuming is
On a live host, inspect --disk-usage before authorizing retention changes. --rotate asks journald to archive active files and open replacements. --vacuum-size=1G removes oldest archived files until their usage falls below one gibibyte; G is base 1024. --vacuum-time=30days deletes archived files older than that span. That is a deletion policy, not a query for the last thirty days. The lines below are distinct syntax examples, not a sequence to paste. None was executed here. Do not run them during an incident or on a shared host without retention authority and an evidence-preservation plan.
Vacuuming cannot remove active files, so --disk-usage may stay above a target. Journalctl 255 permits combining --rotate and vacuuming, making previously active data eligible for deletion. Journald.conf 255 defines ongoing controls: SystemMaxUse limits persistent /var journal use and RuntimeMaxUse limits volatile /run use; SystemKeepFree and RuntimeKeepFree reserve space for other filesystem users in those respective locations. These are journald settings, not logrotate settings.
journalctl --rotate
journalctl --vacuum-size=1G
journalctl --vacuum-time=30daysRotate archives active files. Each vacuum option permanently removes qualifying archived files. Combining them increases deletion eligibility; the teaching fixture is no reason to run these on a host.
Check whose journal you can actually see
By default journalctl shows records the caller can read. System journals are generally restricted to root and designated groups, so silence for one reader does not mean a file is empty. --user selects the current user's journal when persistent per-user journals exist, not every person's records. Journald.conf 255 explains that persistence requirement.
A service configured with LogNamespace can write to a named journal namespace instead of the default. On an authorized host where a clitdj namespace and actual service exist, --namespace=clitdj selects that namespace. It does not create the namespace or grant access. The special --namespace='*' interleaves all namespaces and substantially broadens scope. Journalctl 255 and systemd-journald.service 255 document this boundary. The command is source-verified live-host syntax, not a test of namespaces with the synthetic file.
The practical end state is a bounded question and an honest limit: which boot, unit or fields, interval, account, namespace, and retained files? A quiet result answers only that query over accessible history.
journalctl --no-pager --namespace=clitdj -b -u ACTUAL.service -n 20Replace ACTUAL.service with a real authorized unit. Run only if that namespace exists and you may read it. Output varies; this query does not change daemon configuration.