Episode 07logs

Codex CLI already reports what every turn sends

Codex CLI ships an OpenTelemetry exporter and leaves it off. One [otel] block in ~/.codex/config.toml turns on a record per event, with token counts.

Ship telemetry toUse an OTLP endpoint you already have, from another vendor or your platform team. This one needs a one-time setup step: save your endpoint and the episodes fill it in.Set your endpointRun an OpenTelemetry Collector on your machine and watch telemetry arrive in its terminal. No account needed.More detailsShip straight to Bronto. You need an account and an API key with ingest permission.More details

Switch it on

Add an [otel] block to ~/.codex/config.toml. Codex ships the exporter and leaves it switched off; every turn then arrives as logs, one record per event, with the token counts on each completed response. The endpoint is used exactly as written, so name the logs path yourself.

[otel]
environment = "production"
log_user_prompt = false

[otel.exporter.otlp-http]
endpoint = "https://ingestion.eu.bronto.io/v1/logs"
protocol = "binary"

[otel.exporter.otlp-http.headers]
x-bronto-api-key = "<BRONTO_API_KEY>"

Codex does not expand $VAR in a header value, so the key goes in literally.

[otel]
environment = "production"
log_user_prompt = false

[otel.exporter.otlp-http]
endpoint = "http://localhost:4318/v1/logs"
protocol = "binary"

This assumes a Collector listening on localhost:4318; the Local Collector setup shows how to start one.

This uses the endpoint and auth header you saved in the setup guide.

[otel]
environment = "production"
log_user_prompt = false

[otel.exporter.otlp-http]
endpoint = "YOUR_OTLP_ENDPOINT/v1/logs"
protocol = "binary"

[otel.exporter.otlp-http.headers]
YOUR_AUTH_HEADER = "YOUR_AUTH_VALUE"