Structured JSON logging¶
RTB logs through tracing. For machine-parseable output, install the
JSON formatter; for opt-in usage events, use
rtb-telemetry. Both redact secrets
automatically.
JSON-formatted logs¶
rtb-cli wires tracing-subscriber for you. To force JSON output
(e.g. for log shipping), the subscriber honours the standard
RUST_LOG filter plus the tool's JSON-output flag. Spans and fields
serialise as one JSON object per line:
{"timestamp":"2026-05-24T09:00:00Z","level":"INFO","fields":{"message":"deploy started","target":"prod"},"target":"mytool::deploy"}
In tests, never install the subscriber globally — use
tracing_subscriber::fmt().with_test_writer() or the tracing-test
crate.
Telemetry events¶
rtb-telemetry emits opt-in usage events to pluggable sinks, keyed by
a salted, hashed machine ID (the raw machine ID never leaves the
host). It applies rtb-redact
automatically to the args and err_msg fields of every event, so a
command line carrying a token is scrubbed before it reaches any sink.
Redaction is automatic — but extend it for free-form strings¶
The telemetry path and the HTTP middleware redact known fields for
you. For any other free-form string you send to an external surface,
route it through rtb_redact::string first:
rtb-redact strips URL userinfo, credential query params,
Authorization headers, and well-known token prefixes
(sk-, ghp_, AIza, sk-ant-…, …). See its
component page for the full rule set.
OTLP / distributed tracing¶
rtb-telemetry can export to an OTLP collector for distributed
tracing — endpoints and sinks are configured per the
telemetry spec.