← Lab /Security & privacy

Elastic can monitor Claude AI assistants in real time via OpenTelemetry

Using Elastic’s OpenTelemetry pipeline provides complete, real-time visibility into Claude Code and Claude Cowork activity for security teams.

Security & privacy Elastic Security Labs 25 Apr 2026 Tooling Deployed evidence

Published as “Monitoring Claude Code/Cowork at scale with OTel in Elastic”

Why it matters

Enables security teams to detect misuse of AI coding assistants and respond to incidents with detailed, real-time telemetry.

Summary

Elastic’s InfoSec team built a pipeline that collects OpenTelemetry data from Claude Code and Claude Cowork agents, routing it through either a self-managed EDOT collector gateway or Elastic Cloud’s Managed OTLP endpoint into Elasticsearch. They created custom component and index templates plus ingest pipelines to correctly type numeric fields and parse JSON tool parameters. The resulting data includes user identity, session context, tool invocations, costs and permission decisions, which they use for detection rules such as tool auditing, session reconstruction, and cost anomaly alerts. The writeup shows the configuration works in their internal deployment, but some limitations remain.

What they found 3

  1. Claude Code and Cowork export telemetry via standard OpenTelemetry protocols with five event types

    “Both products export telemetry through standard OpenTelemetry protocols, emitting the same five event types:”

  2. The EDOT collector image provides native Elastic data stream routing, simplifying log placement

    “The EDOT image provides native Elastic data stream routing, which is important for getting logs into the right data streams without extra configuration.”

  3. Elastic Cloud Managed OTLP offers native ingestion, automatic routing, and a built-in failure store

    “With mOTLP, you get native OTLP ingestion with automatic data stream routing, a built-in failure store to protect data during indexing issues, and no APM Server requirement.”

Caveats 7

  • Claude Code telemetry is opt-in and redacts prompts and tool arguments by default; enable them with OTEL_LOG_USER_PROMPTS=1 and OTEL_LOG_TOOL_DETAILS=1
  • It is not currently possible to control index permissions for mOTLP
  • If the gateway endpoint is not allowlisted for Cowork’s sandbox, telemetry export will fail silently
  • Telemetry export requires setting the data_stream.dataset attribute; otherwise data lands in a generic OTel stream
  • Claude Code telemetry redacts prompts and tool arguments unless explicitly enabled
  • Managed OTLP does not allow custom index permission controls
  • Future work is needed to extract high-value fields from JSON payloads into dedicated mapped fields

What’s new here 4

  • Deployed a self-managed Elastic Distribution of OpenTelemetry Collector (EDOT) gateway for ingesting Claude telemetry
  • Provided a Managed OTLP endpoint option for Elastic Cloud users, eliminating the need for a gateway
  • Implemented custom Elasticsearch component templates, index templates, and ingest pipelines to fix field types and parse JSON tool parameters
  • Defined security-focused use cases like tool invocation auditing, session reconstruction, permission decision analysis, and cost anomaly detection