slog API, with the otelslog bridge and the OpenTelemetry otlploghttp exporter sending them over OTLP HTTP.
Prerequisites
- A running Rootprint instance. Substitute its host for
<your-rootprint>. - Go 1.25+.
- 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
Create a module and install the OpenTelemetry packages
2
Set environment variables
3
Minimal working example
Log with
InfoContext, ErrorContext, and the other *Context methods wherever a request context is in scope. A call without the context carries no span, so the log can’t open its trace.4
Verify in Rootprint
Open Logs, filter on
service_name:my-go-service, and your record should appear within a few seconds.Structured logging
Pass key/value pairs throughslog. The bridge turns them into log record attributes.
Framework recipe: Gin
Set up the provider once at startup, then log from a middleware with the request’s context.Troubleshooting
- 401 or 403: the ingest API key is missing or wrong, or the space after
Bearerisn’t written as%20. CheckOTEL_EXPORTER_OTLP_LOGS_HEADERS. 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.- Nothing in Logs from a short-lived script: the batch processor buffers records. Shut down the logger provider before exit, as the minimal example does.
- TLS errors against a self-signed endpoint: set
OTEL_EXPORTER_OTLP_CERTIFICATE=/path/to/ca.pem.

