Elastic Details OpenTelemetry Monitoring for Claude Code and Cowork

Summary
Elastic’s InfoSec team describes collecting Claude Code and Cowork OpenTelemetry data in Elasticsearch for agent auditing, session reconstruction, permission analysis, and EDR correlation, with self-managed and managed ingestion options.
Key points
- Claude Code and Cowork emit five OpenTelemetry event types, including API requests, tool results, permission decisions, user prompts, and errors, with user and session context.
- Telemetry can reach Elasticsearch through a self-managed EDOT gateway or Elastic Cloud’s Managed OTLP endpoint.
- Custom mappings and an ingest pipeline convert numeric and boolean attributes and parse JSON tool parameters into searchable flattened fields.
- The data supports tool-invocation auditing, session reconstruction, permission analysis, cost anomaly detection, and monitoring MCP server access.
- Correlating agent telemetry with endpoint detection and response events can connect an agent’s stated intent with host activity.
- Claude Code redacts prompts and tool arguments by default; the article says these can be enabled, while Cowork includes full details automatically.
- Elastic recommends collecting Claude enterprise audit logs as well, since agent telemetry does not cover web-interface activity and traditional organization-level audit events.
Article Details
- Defense Focus
- Collect and analyze Claude Code and Claude Cowork telemetry to monitor agent activity, support detection and incident response, and correlate agent intent with endpoint impact.
- Detection Methods
- Audit tool invocations using tool names and parameters to identify unusual shell commands, unexpected MCP server interactions, or potentially unauthorized data access.
- Reconstruct sessions by ordering events with session.id and event.sequence, then inspect prompts, tool activity, accessed data, and API calls.
- Analyze tool_decision events to identify risky auto-approvals and unusual permission patterns.
- Detect cost anomalies using cost_usd across requests, sessions, and users.
- Correlate agent telemetry with endpoint process and file events by timestamp and host; the article also describes network connections as part of the endpoint event context.
- Monitor MCP server and tool access using the flattened MCP server and tool name fields.
- Collect Claude enterprise audit logs through the Compliance API to monitor web-interface activity, logins, permission changes, and organization-level administration.
- Data Sources
- OpenTelemetry events: api_request, tool_result, tool_decision, user_prompt, and api_error, with user and session metadata.
- Tool parameters and inputs, including MCP server and tool names.
- Elastic Defend endpoint process and file events, with network connection context.
- Claude enterprise audit logs from the Compliance API.
- Rule Types
- Elasticsearch field queries using AND and wildcard matching, as in the article's MCP tool query example.
- Platforms
- Self-managed Kubernetes clusters for the EDOT gateway deployment.
- Defensive Actions
- Enable and centrally configure Claude Code and Cowork OpenTelemetry export to a managed OTLP endpoint or an authenticated EDOT gateway.
- Configure mappings and ingest processing so numeric and boolean telemetry fields are queryable and JSON-encoded tool parameters are searchable as structured fields.
- Allowlist the OTLP gateway for outbound network access from the Cowork sandbox.
- Collect Claude enterprise audit logs in addition to endpoint telemetry for visibility into web and administrative activity.
- Correlate agent telemetry with endpoint events during investigations to compare intended actions with observed host impact.
MITRE ATT&CK
T1005 · Data from Local SystemThe article identifies agents reading local files on developer machines as behavior that can expose sensitive data.T1059 · Command and Scripting InterpreterThe article identifies agent execution of shell or CLI commands on endpoints as behavior to monitor.T1078 · Valid AccountsThe article describes agents interacting with internal services through MCP connectors using authorized service connections, which it presents as an access-monitoring concern.T1102 · Web ServiceThe article describes agents searching the web and interacting with external or web APIs, making outbound API activity relevant to monitoring.
Vendors
AnthropicCowork is configured centrally in the Anthropic admin portal and includes full details automatically.ElasticElastic’s InfoSec team implemented an OpenTelemetry-based monitoring pipeline to ingest Claude Code and Claude Cowork telemetry into Elasticsearch for real-time observability, detection, and incident response.
Products
Claude CodeElastic’s InfoSec team implemented an OpenTelemetry-based monitoring pipeline to ingest Claude Code and Claude Cowork telemetry into Elasticsearch for real-time observability, detection, and incident response.Claude CoworkElastic’s InfoSec team implemented an OpenTelemetry-based monitoring pipeline to ingest Claude Code and Claude Cowork telemetry into Elasticsearch for real-time observability, detection, and incident response.Claude DesktopCowork is part of the Claude Desktop app and also runs locally.Elastic CloudThe pipeline includes self-managed EDOT collector and Elastic Cloud Managed OTLP options, custom mappings and ingest pipelines to parse tool parameters, and enables use cases like tool-invocation auditing, sessionElastic DefendIf you are running Elastic Defend on your endpoints, you can correlate Claude’s OTel telemetry with EDR process and file events to understand the full picture.ElasticsearchElastic’s InfoSec team implemented an OpenTelemetry-based monitoring pipeline to ingest Claude Code and Claude Cowork telemetry into Elasticsearch for real-time observability, detection, and incident response.
