-
Notifications
You must be signed in to change notification settings - Fork 0
Journalctl CLI
Every SDK language ships a file-backed journalctl rewrite. It is the fifth
consumption surface: a command-line tool, not a library API. Use it when an
operator or a script needs stock-like journalctl behavior against journal
files or directories without systemd, libsystemd, or a running journald.
All four rewrites implement the same file-backed contract and are validated
against stock journalctl by the shared interoperability matrices: directory
traversal, mixed-format directories, query/follow behavior, and verification.
The rewrites cover file-backed query behavior only:
- input selection:
--file <path>or--directory <path>; - output:
--output default|json|export; - metadata:
--list-boots,--fields,--field <NAME>(unique values); - filtering:
FIELD=valuematches, repeated same-field matches as OR, different fields as AND, and the+disjunction separator; - time and boot windows:
--since,--until,--boot [ID]; - paging:
--head <n>,--tail <n>,--no-tail; - live reads:
--followon actively appended files and directories; - integrity:
--verify, and--verify-key <key>for sealed files, where<key>is the systemd-style verification key<seed>/<start>-<interval>produced when sealing was set up (the same value stockjournalctl --verify-keyaccepts).
Daemon-only operations are out of scope by design. --sync, --flush,
--rotate, and --relinquish-var return a controlled error in every
language.
# Rust (builds the journalctl binary from the workspace)
cargo run --manifest-path rust/Cargo.toml --bin journalctl -- \
--file ./fixtures/system.journal --output json PRIORITY=3
# Go
go run ./go/cmd/journalctl --directory ./journal-dir --list-boots
# Python
python3 python/cmd/journalctl.py --file ./fixtures/system.journal --fields
# Node.js
node node/cmd/journalctl --file ./fixtures/system.journal --tail 20The four rewrites accept the same flags and produce matching output for the shared matrices' covered behavior. When outputs disagree, treat it as an SDK bug and report it.
| Need | Use |
|---|---|
| operator inspection of journal files | journalctl rewrite |
| scripted text/JSON/export extraction | journalctl rewrite |
| integrity check in a pipeline | journalctl rewrite --verify
|
| application reading rows programmatically | reader APIs |
| log explorer queries (facets, histogram, FTS) | Explorer API |
| Netdata-shaped function output | Netdata function boundary |
The CLI is a consumer of the same SDK reader paths; it adds no private capabilities. Anything the CLI can do, the library APIs can do with more control.