std.log bridge, which routes existing std.log calls over OTLP HTTP.
Prerequisites
- A running Rootprint instance. Substitute its host for
<your-rootprint>. - Zig ≥ 0.15.2.
- An ingest API key scoped to an OpenTelemetry logs index such as
otel-logs-v0_9. In Settings → API keys, click Create ingest key and pick the index. See API keys.
Setup
1
Add the SDK to your project
Run this in your project root:Then add these lines to
build.zig after your exe declaration:2
Minimal working example
SDK v0.1.1 doesn’t read the auth header from the environment, so the example sets the endpoint, header, and service name in code. Replace
<your-rootprint> and <your-ingest-api-key>. Leave the OTEL_EXPORTER_OTLP_* endpoint variables unset: they override the endpoint set in code.Save as src/main.zig and run zig build run.3
Verify in Rootprint
Open Logs, filter on
service_name:my-zig-service, and your record should appear within a few seconds.Log levels and attributes
Thestd.log bridge maps Zig log levels to OpenTelemetry log levels:
std.log has no key/value attributes. Format arguments are interpolated into the message, which becomes the log record body:
Troubleshooting
- The program hangs and prints
Deadlock detected: an export failed, for example with a401from a wrong ingest API key. SDK v0.1.1 deadlocks when it logs the failure through thestd.logbridge. Check the endpoint and key inotlp_config. See Response codes. 200but no records in Logs: the ingest API key is scoped to an index without the OpenTelemetry logs schema, so the records are discarded. See Index target.

