Open-source Rust library

Structured logging for Rust that keeps formatting off your thread

rlg pushes each record into a ring buffer and returns. A background thread formats it in one of 14 formats and writes it to os_log on macOS, journald on Linux or standard output.

  • macOS: os_log
  • Linux: journald
  • Windows: stdout
  • WebAssembly
  • OpenTelemetry Collector

What it does

Structured logging that stays off your hot path

Each card opens its section on the features page.

Off the calling thread

fire() checks the level and pushes the record into a 65,536-slot ring buffer. A background thread formats it and does the I/O.

How the engine works

14 output formats

JSON, NDJSON, ECS, GELF, Logstash, OTLP, MCP, logfmt, CLF, CEF, ELF, W3C, Apache and Log4j XML, chosen per record.

See every format

Native sinks

Records go to os_log on macOS and journald on Linux, and to standard output everywhere else.

Where records go

Redaction

rlg-redact scrubs card numbers, JWTs, bearer tokens, email and IPv4 addresses and AWS keys before a record is written.

What gets scrubbed

OpenTelemetry export

rlg-otlp ships records over OTLP/HTTP to a local OpenTelemetry Collector, which forwards them to your backend.

How export works

Logs for AI agents

rlg-mcp serves log files to MCP clients as four tools, with a triage prompt, over stdio or HTTP.

What agents can ask

Command-line tools

Three binaries for the logs you already have

Each installs with cargo install, or comes prebuilt in every GitHub release for macOS, Linux and Windows.

rlg-cli

rlg

Filters records by level, component or attribute and converts them into any of the 14 formats.

Filter and convert

rlg-report

rlg-report

Summarises a log by level and component, ranks the most frequent messages and computes latency percentiles.

Summarise a log

rlg-mcp

rlg-mcp

An MCP server that lets an AI agent tail, filter and summarise log files. Also published as a container image.

Connect an agent

Install

A structured record in a few lines of Rust

Initialise once, keep the guard, and fire records from anywhere. rlg needs Rust 1.88 or newer.

  • cargo add rlg
  • cargo install rlg-cli
src/main.rs
use rlg::log::Log;
use rlg::log_format::LogFormat;

fn main() {
    // Dropping the guard flushes pending records.
    let _guard = rlg::init().unwrap();

    Log::info("User authenticated")
        .component("auth-service")
        .with("user_id", 42)
        .format(LogFormat::JSON)
        .fire();
}
Security

Checked by more than its own tests

rlg runs its engine under Miri and Loom, fuzzes the inputs it parses, and signs what it releases.

rlg is at 0.0.x and has one maintainer: any release may break your build, and the security page lists what has and has not been checked.

Unsafe code
Denied
Fuzz targets
4
Release SBOMs
SPDX, CycloneDX
SBOM signing
Sigstore

In numbers

What the workspace ships

Counted from the rlg repository at version 0.0.15.

Output formats
14
Ring buffer slots
65,536
Minimum Rust version
1.88
Crates on crates.io
10
  • rlg: the engine
  • rlg-cli: the rlg binary
  • rlg-report: log summaries
  • rlg-mcp: MCP server
  • rlg-otlp: OTLP/HTTP export
  • rlg-redact: redaction
  • rlg-tower: tower access logs
  • rlg-test: test capture
  • rlg-wasm: WebAssembly
  • rlg-ebpf: process enrichment

What is rlg?

rlg, the RustLogs project, is a free, open-source structured logging library for Rust. You build a record with a level, a message, a component and typed attributes, then call fire(). fire() checks the level and pushes the record into a 65,536-slot ring buffer; a background thread formats it and writes it to the platform's log: os_log on macOS, journald on Linux, and standard output elsewhere. It is dual-licensed under Apache-2.0 or MIT.

What else is in the box?

Nine satellite crates, released at the same version as the engine: command-line tools to filter, convert and summarise logs, an MCP server that gives AI agents access to log files, an OpenTelemetry exporter, a redactor for secrets and personal data, access logs for tower services, test helpers and WebAssembly bindings. The features page covers each one.

When is it the wrong choice?

When you log a few records a second, a background thread and a large buffer buy nothing a synchronous logger does not already give you. When spans are what you analyse, use tracing. When every record must survive a crash, remember that records wait in memory until the background thread writes them. The FAQ lists the other limits.

Who makes it?

rlg is written by Sebastien Rousseau. The source, the issue tracker and every release are on GitHub; the crates are on crates.io. Read more on the about page.