Security and privacy
- OpenTelemetry export to your backend is opt-in and requires explicit configuration. For Anthropic's separate operational telemetry and how to disable it, see Data usage
- Raw file contents and code snippets are not included in metrics or events. Trace spans are a separate data path: see the
OTEL_LOG_TOOL_CONTENTbullet below - When authenticated via OAuth,
user.emailis included in telemetry attributes, sent only to the OTel endpoint you configure, never to Anthropic. If this is a concern for your organization, work with your telemetry backend to filter or redact this field - User prompt content is not collected by default. Only prompt length is recorded. To include prompt content, set
OTEL_LOG_USER_PROMPTS=1 - Assistant response text is not collected by default. Only response length is recorded. To include response text, set
OTEL_LOG_ASSISTANT_RESPONSES=1. Like all OpenTelemetry data from Claude Code, the response text is sent only to the OTel endpoint you configure, never to Anthropic. When this variable is unset,OTEL_LOG_USER_PROMPTSis used as a fallback, so setOTEL_LOG_ASSISTANT_RESPONSES=0if you want prompt content without response content - Tool input arguments and parameters are not logged by default. To include them, set
OTEL_LOG_TOOL_DETAILS=1. For Claude Desktop's built-in servers, in sessions Claude Desktop owns,tool_decisionandtool_resultcarry themcp_server_name/mcp_tool_namepair, host-authored names rather than argument content, even with the flag off. The exception requires Claude Code v2.1.214 or later. This data is sent only to the OTEL endpoint you configure, never to Anthropic. Arguments may still contain sensitive values, so configure your telemetry backend to filter or redact these attributes as needed. When enabled:tool_resultandtool_decisionevents include atool_parametersattribute with Bash commands, MCP server and tool names, and skill names. Fields such asfull_commandare emitted untruncatedtool_resultevents additionally include atool_inputattribute with file paths, URLs, search patterns, and other arguments. Individual values over 512 characters are truncated and the total is bounded to ~4 K charactersuser_promptevents include the verbatimcommand_namefor custom, plugin, and MCP commands- Trace spans include the same
tool_inputattribute and input-derived attributes such asfile_path, with the same truncation astool_input
- Tool input and output content is not logged in trace spans by default. To include it, set
OTEL_LOG_TOOL_CONTENT=1. When enabled, span events include full tool input and output content truncated at the content limit (60 KB by default) per attribute. This can include raw file contents from Read tool results and Bash command output. Configure your telemetry backend to filter or redact these attributes as needed - Raw Anthropic Messages API request and response bodies are not logged by default. To include them, set
OTEL_LOG_RAW_API_BODIESin your shell, user settings, or managed settings. It's ignored in project and local settings. The bodies contain the full conversation history, including the system prompt, every prior user and assistant turn, and tool results, so enabling this implies consent to everything the otherOTEL_LOG_*content flags would reveal. Claude Code always redacts Claude's extended-thinking content from these bodies, regardless of other settings. The value you set determines how Claude Code delivers the bodies:- With
=1, Claude Code emitsapi_request_bodyandapi_response_bodylog events for each API call. The events'bodyattribute carries the JSON-serialized payload, truncated at the content limit (60 KB by default) - With
=file:<dir>, Claude Code writes untruncated bodies to.request.jsonand.response.jsonfiles under that directory, and the events carry abody_refpath instead of the inline body. Ship the directory with a log collector or sidecar rather than through the telemetry stream
- With