otel-logs-v0_9).
Setup
Structured logging
Attributes become log-record attributes on the OTEL side — searchable and filterable in Logwiz.Framework recipe: Express
Initialise the provider once at process start, then log from anywhere. Keep the setup in a separate module (e.g.otel.js) and import it before your Express app.
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 — the batch processor buffers records. For short-lived scripts call
await provider.forceFlush()before exit. fetch is not defined— upgrade to Node.js 18+ or pass a polyfilled fetch to the exporter.- Pino transport not emitting —
pino-opentelemetry-transportreads theOTEL_*env vars itself; make sure they are set in the process that spawns the transport worker. - TLS errors against a self-signed endpoint — set
NODE_EXTRA_CA_CERTS=/path/to/ca.pem.
