sdjournal
sdjournal is a pure Rust systemd journal reader and query engine. It reads *.journal files directly and does not depend on libsystemd or invoke journalctl (tests may use journalctl for golden comparisons).
Status
- Target OS: Linux (non-Linux builds are supported for compilation, but
Journal::open_default()is Linux-only). - Designed for production use: corruption-/truncate-resistant parsing, bounded resource usage, stable merge ordering, cursor checkpoints, follow/tail with rotate support.
Supported systemd / sample matrix
This project is validated in CI on:
- Ubuntu 22.04 (systemd 249.x) as the minimum tested version
- Ubuntu 24.04 (systemd 255.x) as the target tested version
See .github/workflows/ci.yml for the exact matrix and the logged systemd --version output.
Features
- Default:
mmap,lz4,zstd - Optional:
xz: enable XZ decompressiontracing: emit diagnostics viatracing(caller installs a subscriber)tokio: provides an async follow adapterverify-seal: verify Forward Secure Sealing (TAG/FSS) with a systemd verification key
Quickstart
use Journal;
let journal = open_default?;
let mut q = journal.query;
q.match_exact;
q.since_realtime;
for item in q.iter?
# Ok::
Cursor checkpoint (resume after restart)
An end-to-end example that persists the last cursor and resumes via after_cursor is in:
crates/sdjournal/examples/checkpoint_follow.rs
Run it on Linux:
Development
- Format:
cargo fmt - Lint:
cargo clippy --workspace --all-targets --all-features -- -D warnings - Test:
cargo test --workspace --all-features - Fuzz (nightly):
cargo +nightly fuzz run journal_open