#parser #systemd #journal #journald

yanked journald-parser

A parser for the systemd journal format

0.1.0 Jul 25, 2023

#12 in #journald

MIT license

15KB
328 lines

Journald-parser

Table of contents

Introduction

Welcome to the Rust Parser for systemd-journal-gatewayd Logs project! This is an open-source Rust library designed to parse and extract relevant information from logs gathered via systemd-journal-gatewayd. The parser aims to provide developers and system administrators an efficient way to handle and analyze logs from the gatewayd service. The systemd logs protocol can be found here

Please note that this parser is specifically tailored to work with logs generated by systemd-journal-gatewayd and may not be compatible with logs from other sources or services. In addition it is specifically created to parse Journal Export Format.

Features

  • Efficient Parsing: The parser is designed to efficiently process large log files to extract valuable information while keeping resource usage in check.
  • Structured Data: The parsed logs are transformed into structured data formats, allowing for easy manipulation and analysis.
  • Error Handling: The parser implements robust error handling to gracefully handle malformed or unexpected log entries.

Installation

To use the parser in your Rust code simply add it to your Cargo.toml file as follows:

[dependencies]
journald_parser = "0.1.0"

Usage

The parser can be used as follows:

use journald_parser::parse;

fn main() {
    let data_as_bytes: Vec<u8> = fetch_logs();

    let batch = parse(data_as_bytes);

    // Do something with the parsed logs
    for entry in batch.get_entries() {
        println!("Entry: {:#?}", entry);
    }
}

fn fetch_logs() -> Vec<u8> {
    // Fetch logs from systemd-journal-gatewayd
    unimplemented!()
}

No runtime deps