Skip to main content

ai.raw.anthropic.claude_code.logs

Note

This dataset is restricted by default: no one can read its data until access is granted through a target group rule on its access policy. To grant access, see Access control.

Purpose​

The ai.raw.anthropic.claude_code.logs dataset stores the log events that Claude Code sends over OpenTelemetry: the prompts developers enter, the model requests and errors, and the tool calls the agent decides on and runs. The cost and token metrics behind the Code Agents dashboards live in the claude_code_* metrics. This dataset holds the event-level detail behind them, so you can rebuild what happened in a session and tie spend to the prompts and tool calls that caused it.

ai.raw.anthropic.claude_code.logs is a predefined dataset: Coralogix provisions it in the default dataspace, and your Claude Code telemetry fills it. Its entity type is rawAnthropicClaudeCodeLogs. Claude Code spans go to a separate dataset, ai.raw.anthropic.claude_code.spans.

This dataset replaces ai.sessions.claude.

How events reach the dataset​

Coralogix routes a Claude Code log to this dataset when its OpenTelemetry resource attributes identify Claude Code as the source:

Resource attributeValue
cx.integration.source.typeclaude_code_agent

Logs that carry the newer name, cx.source.integration.type, also route here. Claude Code metrics use only cx.integration.source.type, so keep that name. Logs without either attribute go to your logs dataset as before.

What one event is​

Each event is one OpenTelemetry log record that Claude Code emits. The body field names the event type, and attributes holds the event's payload.

FieldDescription
bodyThe event type, for example claude_code.api_request. See Event types.
attributesThe event payload. Common attributes appear on every event; the rest depend on the event type.
resource.attributesAttributes Claude Code sets for the whole session, including cx.application.name, cx.subsystem.name, and the source marker.

Event types​

EventWhen it firesNotable attributes
claude_code.user_promptA developer enters a prompt.prompt (only when OTEL_LOG_USER_PROMPTS=1)
claude_code.api_requestClaude Code calls the model.model, token counts, cost_usd, duration_ms
claude_code.api_request_bodyClaude Code sends a request to the model.body (only when OTEL_LOG_RAW_API_BODIES=1)
claude_code.api_response_bodyThe model returns a response.body (only when OTEL_LOG_RAW_API_BODIES=1)
claude_code.api_errorA model call fails.status, error message
claude_code.tool_resultA tool call completes.Tool name, duration, outcome, tool_parameters
claude_code.tool_decisionThe agent decides whether to run a tool.Tool name, decision, source

Common attributes​

These appear under attributes on every event:

AttributeDescription
session.idClaude Code session ID. Use it to join events with each other and with the cost and token metrics.
user.idThe Anthropic user ID.
user.account_uuidThe Anthropic account UUID.
user.emailThe user's email, when the user signed in with OAuth.
organization.idThe Anthropic organization ID.
app.versionClaude Code version.
terminal.typeThe terminal Claude Code runs in.
modelActive model identifier.

Content capture​

Prompt text, raw request and response bodies, and tool content are off by default. Developers turn them on with these environment variables in the Claude Code env block:

VariableWhat it adds
OTEL_LOG_USER_PROMPTS=1The prompt attribute on claude_code.user_prompt events.
OTEL_LOG_RAW_API_BODIES=1claude_code.api_request_body and claude_code.api_response_body events with the full request and response JSON. Beta: also requires CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1.
OTEL_LOG_TOOL_CONTENT=1The content tool calls return, on claude_code.tool_result events.
OTEL_LOG_TOOL_DETAILS=1MCP server and tool names on claude_code.tool_result events, and tool_parameters for MCP and Skill tool calls. Bash tool parameters (bash_command, full_command, description) are sent by default.

Without these variables, the dataset still records each event, the user, and the model, without the text.

Query the dataset​

source ai.raw.anthropic.claude_code.logs
| filter $d.body == 'claude_code.api_request'

Next steps​

Last updated on