#journald #systemd #export #journal #field #sync #async-read

journald-export-parser-rs

Journald Journal Export Format Parser

1 unstable release

0.1.0 Jun 18, 2024

#1241 in Parser implementations

Custom license

40KB
920 lines

journald-export-parser-rs

Rust Journald Export Format Parser


lib.rs:

Journald Journal Export Format Parser.

This library contains a small parser for the Journald Journal Export Format.

The format is very versatile. Each stream consists of a series of journal entries, each of which comprising one or more fields. A field is simply a key value pair, similar to Unix process environment variables.

The parser avoids heap allocations and operates on a buffer with bounded size. The lengths of the fields and overall entry size can be controlled using with the config::JournalExportLimits struct.

The parsing logic is separated out from any i/o-logic. self::journald::parser::JournalExportParser contains the parser logic and manages the buffer. The structs [JournalExportAsyncRead] and [JournalExportRead] provide async and sync versions of a parser.

Implementation notes

Both, [JournalExportRead] and [JournalExportAsyncRead] are stateful objects that buffer the last parsed journal entry. The latter can be accessed using the get_entry()-method which returns a journald::parser::RefEntry object.

Dependencies

~1.3–2MB
~40K SLoC