Content: what is off by default, and the four gates that turn it on
This is the section to read before enabling anything for a team, because the defaults are protective and the switches are not fine-grained in the way people assume. Prompt content is not collected by default: only prompt_length is recorded. Assistant response text is not collected either, only response_length. Tool input arguments are not logged.
OTEL_LOG_USER_PROMPTS=1puts the prompt text onuser_promptevents, in two attributes:promptand, from v2.1.287,prompt_text. The duplicate exists because a backend that stores dotted names as nested objects readsprompt.idas an object and can lose the string, so it needsprompt_text.OTEL_LOG_ASSISTANT_RESPONSES=1puts the response text onassistant_responseevents. If you leave it unset it followsOTEL_LOG_USER_PROMPTS, so settingOTEL_LOG_ASSISTANT_RESPONSES=0is how you keep responses redacted while prompts are being logged.OTEL_LOG_TOOL_DETAILS=1logs tool parameters and input arguments: Bash commands, MCP server and tool names, skill names, subagent types, and file paths. It also stops the cost and token counters redacting agent, skill, plugin and MCP names tocustomorthird-party. Fields such asfull_commandare emitted untruncated.OTEL_LOG_TOOL_CONTENT=1is the heaviest and applies to traces: it puts raw file contents, Bash output, and what MCP tools, WebFetch and WebSearch returned into atool.outputspan event. Results from MCP, WebFetch and WebSearch need v2.1.283 or later.
The one that captures everything at once
Setting OTEL_LOG_RAW_API_BODIES emits the full Anthropic Messages API request and response JSON as api_request_body and api_response_body events. Those bodies contain the entire conversation history (the system prompt, every prior user and assistant turn, and tool results), so Anthropic states plainly that enabling it implies consent to everything the other content flags would reveal. Extended-thinking content is always redacted from those bodies regardless of any other setting. The value decides the delivery: 1 puts the body inline on the event, truncated at the content limit, while file:<dir> writes untruncated .request.json and .response.json files and puts a body_ref path on the event instead. Those files never pass through your collector, so the collector-side rule below cannot remove them: ship the directory with a log collector or sidecar, and secure or delete it.
Every content value is capped
Content-bearing attributes are truncated at 60 KB by default, which is 61440 UTF-16 code units, marker included. That default is chosen to fit backends that cap an attribute value at 64 KB. CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH raises or lowers it, and if you also set an OpenTelemetry SDK limit such as OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT below it, Claude Code truncates at the smaller value so the truncation marker itself still fits. A truncated attribute is accompanied by <attribute>_truncated and <attribute>_original_length.
Drop the content at the collector, not in the client
The pattern to copy is to leave the client honest and filter at the collector, where the rule is visible to whoever audits the pipeline. If prompt text must never be stored, the OpenTelemetry Collector's attributes processor deletes both attributes in the pipelines that list it, which is the documented shape and the one to copy.
processors:
attributes/drop-prompt-text:
actions:
- key: prompt
action: delete
- key: prompt_text
action: deleteOne attribute you cannot drop at the source is worth knowing about: when you are authenticated through OAuth, user.email is included in telemetry attributes, and Anthropic's guidance is to filter or redact it in your own backend if that is a concern. It is sent only to the OTel endpoint you configure and never to Anthropic.