Skip to content

Configure OpenAI Codex to publish to the collector

Codex configures its OpenTelemetry exporter through ~/.codex/config.toml. There is no OTEL_* environment-variable path.

For the upstream reference: Codex Advanced Configuration → OpenTelemetry.

Prerequisites

Finish Deploy the collector on the host first.

What to set

Add an [otel] block to ~/.codex/config.toml:

[otel]
environment = "prod"
log_user_prompt = false
exporter = { otlp-http = { endpoint = "http://127.0.0.1:4318/v1/logs", protocol = "binary" } }

The full path matters — Codex sends to the configured endpoint as a literal URL and does not auto-append /v1/logs.

Restart codex (or restart Codex Desktop) to pick up the change.

Codex Desktop

Codex Desktop reads the same ~/.codex/config.toml. No separate configuration is needed once the CLI step above is done.

See also