rlg is a near-lock-free structured logging solution for Rust, whose design goal is to complete record submission on application threads with a small number of atomic operations, deferring formatting and writing to a background flusher thread.
Purpose and positioning rlg is aimed at Rust applications that need high-throughput structured logging, especially scenarios where calling threads should avoid waiting on logging sink I/O. It replaces tracing's span model with an engine that records only events, and provides native sinks, multiple output formats, and agent-oriented interfaces among its built-in capabilities.
Main capabilities
- Engine: a 65,536-slot ring buffer; records leave the application thread after a small number of atomic operations, and are formatted and written out by a background flusher.
- Output formats: 14, including JSON, ECS, GELF, OTLP, logfmt, and others.
- Native sinks: os_log on macOS and journald on Linux; other platforms (including Windows) write to files or stdout.
- Ecosystem components: rlg, rlg-cli, rlg-report, rlg-mcp, rlg-otlp, rlg-redact, rlg-tower, rlg-test, rlg-wasm, rlg-ebpf, ten crates released with synchronized version 0.0.15.
- Additional capabilities: OTLP/HTTP exporter, MCP server for AI agents, Tower middleware, PII redaction, WebAssembly bindings, jq-style CLI.
- Configuration: loaded from TOML and validated, creating required logging paths; can be loaded with Config::load(Some("rlg.toml")), under the tokio feature Config::load_async can be used, and Config::hot_reload_async can track edits; RUST_LOG can also set the level. All optional features are disabled by default.
Usage
- Library installation: install the library via Cargo; satellite crates are installed in sync with the same version.
- Command-line tools: run make install in the checkout directory, which builds three binaries and installs them along with the manpage and bash, zsh, and fish completions to /usr/local (PREFIX and DESTDIR are supported; make uninstall can undo it). The binaries can generate documentation themselves: rlg --manpage > rlg.1, rlg --completions zsh > _rlg.
- MCP server: rlg-mcp is also published as the container image ghcr.io/sebastienrousseau/rlg-mcp, and is listed in the MCP registry.
- Quick start: fire() checks the level, pushes the record into the ring buffer, and returns; the flusher thread formats it as JSON and writes it to the platform sink. This code block is compiled and run by cargo test.
- Environment requirements: Rust 1.88.0 or newer (edition 2024); CI builds all libraries and binaries on 1.88.0. Native sinks (os_log, journald) require macOS or Linux.
Applicable scenarios
- High-throughput Rust server-side logging where calling threads should not wait on sink I/O.
- Projects that need multiple structured output formats (JSON, ECS, GELF, OTLP, logfmt, etc.) and native platform sinks.
- Logging workflows that need OTLP/HTTP export, Tower middleware, PII redaction, WebAssembly bindings, or a jq-style CLI.
- Scenarios that need to provide a logging access interface for AI agents (MCP server).
Limitations
- Low throughput: below about one hundred records per second, the background thread plus 65k-slot buffer provides no extra benefit compared with a synchronous logger.
- Span model: rlg records events; if analysis depends on hierarchical spans, use tracing directly, as rlg's layer only bridges its events.
- Windows Event Log: there is no native Windows sink; on Windows, write to files or stdout.
- Crash survival: records reside in memory before the flusher writes them out; if the process is killed before FlushGuard is destroyed, the buffer contents are lost.
- API stability: rlg is at 0.0.x, any version may break compatibility, and there is only one maintainer.
Security and stability
- Memory safety: unsafe is forbidden in the workspace, except for the macO documented in crates/rlg/src/sink.rsS os_log FFI exceptions; the engine runs under Miri on every push.
- Resource limits: the ring buffer is capped at 65,536 records, evicting the oldest when full; rlg-otlp sets the collector response header limit to 16 KiB and sets a timeout for each request.
- Fuzzing: four cargo-fuzz targets (record parsing, format names, configuration loading, redaction) run on every pull request.
- Supply chain: all dependencies via cargo-deny and cargo-vet; releases via crates.io Trusted Publishing with a sigstore-signed SBOM.
- Stability guarantees: the SemVer axis is 0.0.x, and under Cargo rules every release may break compatibility; breaking changes are marked as Breaking in the CHANGELOG, and cargo-semver-checks runs on every pull request. Output bytes are treated as an interface, and a change in the output for the same record is a breaking change even if the signature has not changed. The minimum toolchain Rust 1.88.0 is enforced in CI.
- License: Apache License 2.0 or MIT dual-licensed, as chosen by the user.