ai.raw.anthropic.claude_code.logs
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 attribute | Value |
|---|---|
cx.integration.source.type | claude_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.
| Field | Description |
|---|---|
body | The event type, for example claude_code.api_request. See Event types. |
attributes | The event payload. Common attributes appear on every event; the rest depend on the event type. |
resource.attributes | Attributes Claude Code sets for the whole session, including cx.application.name, cx.subsystem.name, and the source marker. |
Event types
| Event | When it fires | Notable attributes |
|---|---|---|
claude_code.user_prompt | A developer enters a prompt. | prompt (only when OTEL_LOG_USER_PROMPTS=1) |
claude_code.api_request | Claude Code calls the model. | model, token counts, cost_usd, duration_ms |
claude_code.api_request_body | Claude Code sends a request to the model. | body (only when OTEL_LOG_RAW_API_BODIES=1) |
claude_code.api_response_body | The model returns a response. | body (only when OTEL_LOG_RAW_API_BODIES=1) |
claude_code.api_error | A model call fails. | status, error message |
claude_code.tool_result | A tool call completes. | Tool name, duration, outcome, tool_parameters |
claude_code.tool_decision | The agent decides whether to run a tool. | Tool name, decision, source |
Common attributes
These appear under attributes on every event:
| Attribute | Description |
|---|---|
session.id | Claude Code session ID. Use it to join events with each other and with the cost and token metrics. |
user.id | The Anthropic user ID. |
user.account_uuid | The Anthropic account UUID. |
user.email | The user's email, when the user signed in with OAuth. |
organization.id | The Anthropic organization ID. |
app.version | Claude Code version. |
terminal.type | The terminal Claude Code runs in. |
model | Active 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:
| Variable | What it adds |
|---|---|
OTEL_LOG_USER_PROMPTS=1 | The prompt attribute on claude_code.user_prompt events. |
OTEL_LOG_RAW_API_BODIES=1 | claude_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=1 | The content tool calls return, on claude_code.tool_result events. |
OTEL_LOG_TOOL_DETAILS=1 | MCP 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
- Set up the source: Claude Code.
- Grant read access to more users: Access control.
- See the other datasets Coralogix provisions in Predefined datasets.