rlg-report 0.0.11

Log digest / analytics for rlg. Reads JSON-shaped rlg records from a file or stdin and produces aggregation tables: count by level, top components, top error messages, latency percentiles.
Documentation

Install

cargo install rlg-report

Requires Rust 1.88.0 or newer (edition 2024).

CLI

# Pretty-printed digest of a log file.
rlg-report /var/log/app.ndjson

# JSON output for a dashboard.
rlg-report --format json /var/log/app.ndjson

# Read from stdin (e.g. piped from `rlg`).
my-service | rlg --format ndjson | rlg-report

# Keep only the top 3 description buckets.
rlg-report --top 3 /var/log/app.ndjson

Sample output

── rlg report ───────────────────────────────────────────
total records:      18421
unparseable lines:  0

── by level ─────────────────
  INFO       16842
  WARN       912
  ERROR      640
  FATAL      27

── by component ─────────────
  api        12001
  db         3920
  orchestrator 2500

── top descriptions ─────────
   1240  GET /v1/users -> 200
    320  POST /v1/orders -> 201
    274  user authenticated
    ...

── latency (ms) ─────────────
  samples  16980
  p50      14
  p95      82
  p99      210
  max      4012

Library mode

use rlg_report::Report;

let lines: Vec<&str> = my_log_lines();
let report = Report::from_lines(lines.into_iter());

println!("errors-and-above: {}", report.error_count());
if let Some(latency) = report.latency {
    println!("p99 latency: {} ms", latency.p99);
}

License

Dual-licensed under Apache 2.0 or MIT, at your option.