npx claudepluginhub ctdio/datadog-cliDatadog CLI for debugging and triaging - search logs and APM traces, tail in real-time, trace requests, analyze patterns, compare periods, query metrics, and find slow spans
A CLI for querying Datadog logs, metrics, and APM traces from your terminal.
I wanted a tool that Claude (and other AI assistants) could use to help investigate production issues. Figured I'd vibe my own because why not.
Run directly without installing:
npx @ctdio/datadog-cli <command>
# or
bunx @ctdio/datadog-cli <command>
Or install locally:
bun install
Install as a Claude Code plugin to give Claude knowledge of the CLI:
# Add the marketplace (one-time)
/plugin marketplace add ctdio/datadog-cli
# Install the plugin
/plugin install datadog-cli
Once installed, Claude can help you debug with Datadog:
Set your Datadog API credentials:
export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
Get keys from: https://app.datadoghq.com/organization-settings/api-keys
For EU or other sites:
export DD_SITE="datadoghq.eu" # or us5.datadoghq.com, etc.
bun run cli.ts <command> [subcommand] [flags]
Or create an alias:
alias datadog="bun run /path/to/cli.ts"
# Search logs
datadog logs search --query "status:error" --from 1h --pretty
# Aggregate logs by facet
datadog logs agg --query "service:api" --facet status --from 24h --pretty
# Live tail - stream logs as they come in
datadog logs tail --query "service:api status:error" --pretty
# Find all logs for a trace
datadog logs trace --id "abc123def456" --pretty
# Get context around a timestamp (before/after)
datadog logs context --timestamp "2024-01-15T10:30:00Z" --service api --before 5m --after 2m --pretty
# Quick error summary
datadog errors --from 1h --pretty
# Error summary for specific service
datadog errors --service api --from 24h --pretty
# Detect log patterns
datadog logs patterns --query "status:error" --from 1h --pretty
# Compare current vs previous period
datadog logs compare --query "status:error" --period 1h --pretty
# List all services with recent log activity
datadog services --from 24h --pretty
# Query metrics
datadog metrics query --query "avg:system.cpu.user{*}" --from 1h --pretty
# Search spans
datadog spans search --query "env:prod service:api" --from 1h --pretty
# Find slow requests (over 1 second)
datadog spans search --query "service:api" --min-duration 1s --from 1h --pretty
# Aggregate spans by facet
datadog spans agg --query "env:prod" --facet service --from 24h --pretty
# View trace hierarchy (parent-child relationships)
datadog spans trace --id "abc123def456" --pretty
# Span error summary
datadog spans errors --from 1h --pretty
datadog spans errors --service api --from 24h --pretty
# List services with APM activity
datadog spans services --from 24h --pretty
# Export results to file
datadog logs search --query "*" --limit 1000 --output logs.json
# Run multiple queries at once
datadog logs multi --queries "errors:status:error,warnings:status:warn" --from 1h --pretty