datadog

Query and analyze Datadog logs, metrics, APM traces, and monitors using the Datadog API. Use when debugging production issues, monitoring application performance, or investigating alerts.

⭐16stars🔀4forks📁View on GitHub🕐Updated Jan 9, 2026⬇️1downloads

When & Why to Use This Skill

This Claude skill integrates directly with the Datadog API to provide comprehensive observability and diagnostic capabilities. It allows users to perform real-time log analysis, query system and application metrics, inspect APM traces, and manage monitors. By centralizing telemetry data access, it empowers DevOps and SRE teams to accelerate root cause analysis, track performance trends, and maintain high system availability through an intelligent agent interface.

Use Cases

  • Incident Response: Rapidly search and filter production error logs to identify the root cause of service disruptions or high error rates.
  • Performance Monitoring: Query and visualize system metrics like CPU usage, memory consumption, or custom business KPIs to detect performance bottlenecks.
  • Distributed Tracing: Analyze APM traces and spans to map request flows across microservices and pinpoint latency issues in complex architectures.
  • Alert Investigation: Retrieve the status and configuration of Datadog monitors to understand alert triggers and review recent event history during on-call rotations.
namedatadog
descriptionQuery and analyze Datadog logs, metrics, APM traces, and monitors using the Datadog API. Use when debugging production issues, monitoring application performance, or investigating alerts.

Datadog

Before performing any Datadog operations, first check if the required environment variables are set:
[ -n "$DD_API_KEY" ] && echo "DD_API_KEY is set" || echo "DD_API_KEY is NOT set"
[ -n "$DD_APP_KEY" ] && echo "DD_APP_KEY is set" || echo "DD_APP_KEY is NOT set"
[ -n "$DD_SITE" ] && echo "DD_SITE is set" || echo "DD_SITE is NOT set"

If any of these variables are missing, ask the user to provide them before proceeding:

  • DD_API_KEY: Datadog API key
  • DD_APP_KEY: Datadog Application key
  • DD_SITE: Datadog site (e.g., datadoghq.com, datadoghq.eu, us3.datadoghq.com)

Authentication Headers

-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-H "Content-Type: application/json"

Query Logs

curl -s -X POST "https://api.${DD_SITE}/api/v2/logs/events/search" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "query": "service:my-service status:error",
      "from": "now-1h",
      "to": "now"
    },
    "sort": "-timestamp",
    "page": {"limit": 50}
  }' | jq .

Query Metrics

curl -s -G "https://api.${DD_SITE}/api/v1/query" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
  --data-urlencode "query=avg:system.cpu.user{*}" \
  --data-urlencode "from=$(date -d '1 hour ago' +%s)" \
  --data-urlencode "to=$(date +%s)" | jq .

Query APM Traces

curl -s -X POST "https://api.${DD_SITE}/api/v2/spans/events/search" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "query": "service:my-service",
      "from": "now-1h",
      "to": "now"
    },
    "sort": "-timestamp",
    "page": {"limit": 25}
  }' | jq .

List Monitors

curl -s -G "https://api.${DD_SITE}/api/v1/monitor" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" | jq .

Documentation