$ recombobulate _
home / tips / export-claude-code-events-with-opentelemetry-logs
0

Export Claude Code Events with OpenTelemetry Logs

bagwaa @bagwaa · Mar 26, 2026 · Configuration
export-claude-code-events-with-opentelemetry-logs

Most people know Claude Code can export OTel metrics, but it also exports detailed events via the logs protocol. This gives you a full audit trail of every tool call, API request, and user prompt.

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

You get four event types out of the box: claude_code.user_prompt (when a user submits input), claude_code.tool_result (when a tool finishes), claude_code.api_request (for each API call with cost and token counts), and claude_code.api_error (when requests fail).

Each event includes duration_ms, success status, and tool-specific attributes. Want to see which tools fail most? Filter by success: "false". Want to audit file changes? Look at tool_result events where tool_name is Edit or Write.

For sensitive environments, prompt content is redacted by default. Enable it explicitly with OTEL_LOG_USER_PROMPTS=1 if you need full audit logging.

Metrics tell you how much. Events tell you exactly what happened.


via Claude Code Docs — Monitoring Usage

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Switch to the Stable Update Channel with autoUpdatesChannel

The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.

bagwaa @bagwaa · 1 hour ago
0
Set Claude's Response Language with the language Setting

The language setting makes Claude respond in your preferred language by default, across every session and project.

bagwaa @bagwaa · 1 hour ago
0
Customize or Remove Claude's Git Attribution with the attribution Setting

The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.

bagwaa @bagwaa · 1 hour ago