proto-http). The Python SDK’s OTLPLogExporter speaks this protocol directly — install it, set three env vars, and emit records through logging. Records land in the OTEL logs index pinned by your ingest token (default: otel-logs-v0_9).
Setup
Install the OpenTelemetry SDK
opentelemetry-instrumentation-asyncio.Structured logging
Attach attributes via theextra kwarg on the standard logging API — the OTEL handler translates them into log record attributes.
attributes.user_id and attributes.plan in Logwiz and become searchable and filterable.
Framework recipe: FastAPI
FastAPI apps work the same way — set up the provider once at startup. Put the exporter config in your app factory so every worker process picks it up.Troubleshooting
- 401 / 403 — the Bearer token is missing, malformed, or the
%20separator is not URL-encoded. Re-checkOTEL_EXPORTER_OTLP_LOGS_HEADERS. - Nothing in Search — records are batched; wait 2–5 s or call
logger_provider.force_flush()from your script. Also verifyOTEL_SERVICE_NAMEis set so you can filter onservice_name. - TLS errors against a self-signed endpoint — set
OTEL_EXPORTER_OTLP_CERTIFICATE=/path/to/ca.pem. - Records rejected by Quickwit — the token is scoped to a specific index. If that index’s schema doesn’t accept the record, create a token for a different index. See Manage indexes.
Related
- OTLP reference — endpoint URL, response codes, env-var table
- Indexes —
otel-logs-v0_9schema and custom-index concepts - Per Index configuration — map log level, message, and traceback fields
