Claude Code
Send Claude Code's logs, metrics and traces to Berserk with an ingest token
Claude Code exports OpenTelemetry logs, metrics and traces: prompts, API requests with tokens and cost, and tool calls. It sends them over OTLP/gRPC to your ingest endpoint. AI Sessions shows the traces as sessions of turns.
Create an Ingest Token
Create a token on Settings → Databases → Tokens, or with the CLI:
bzrk ingest-token create --table default claude-codeThe token value is shown once. This token sends every signal to the default table; to choose other tables, see Ingest Tokens.
Configure Claude Code
Add this env block to ~/.claude/settings.json. The endpoint is the OTLP gRPC address from Settings → Endpoints; on Managed Berserk it is ingest.<your-domain>:4317.
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"CLAUDE_CODE_ENHANCED_TELEMETRY_BETA": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_TRACES_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://ingest.<your-domain>:4317",
"OTEL_EXPORTER_OTLP_HEADERS": "authorization=Bearer <your-ingest-token>"
}
}Restart Claude Code. It reads the settings when it starts.
CLAUDE_CODE_ENHANCED_TELEMETRY_BETAturns on traces. Without it Claude Code exports only logs and metrics, and AI Sessions stays empty.https://connects with TLS. Usehttp://only for a plaintext endpoint, such as an in-clusteringest:4317.- Claude Code ignores the exporter variables in a repository's
.claude/settings.json. To set them for every developer, put theenvblock in managed settings.
Prompts and Tool Content
Claude Code leaves prompt text, tool arguments, tool output and its responses out of its telemetry. Set any of these to "1" in the env block to include them:
| Variable | Includes |
|---|---|
OTEL_LOG_USER_PROMPTS | Prompt text |
OTEL_LOG_TOOL_DETAILS | Tool arguments, such as Bash commands and MCP tool input |
OTEL_LOG_TOOL_CONTENT | Tool output, on the trace |
OTEL_LOG_ASSISTANT_RESPONSES | Claude's responses. Unset, it follows OTEL_LOG_USER_PROMPTS |
Verify
Run a prompt in Claude Code, then:
bzrk search "default | where resource['service.name'] == 'claude-code' | take 10" --since "5m ago"