datadog-cli

Query Datadog logs, metrics, traces, and dashboards from the command line.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/leonardoacosta/agents --skill datadog-cli-leonardoacosta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: datadog-cli
Source: https://github.com/leonardoacosta/agents/tree/main/skills/datadog-cli
Command: npx skills add https://github.com/leonardoacosta/agents --skill datadog-cli-leonardoacosta

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @leoflores/datadog-cli, and includes references (resource) components.

What problem does it solve? Debugging production incidents requires fast access to Datadog logs, metrics, and traces, but navigating the web UI is slow and hard to automate. This Skill gives an AI agent a CLI workflow to search logs, correlate traces, query metrics, and manage dashboards directly. ## Core Features & Use Cases - Log Search & Analysis: Search, tail, aggregate, and compare logs with Datadog query syntax, including pattern grouping and multi-query parallel execution. - Incident Triage Workflows: Follow a structured sequence from error overview to period comparison, pattern detection, context lookup, and distributed trace correlation. - Dashboard Management: Create, read, update, and delete dashboards and dashboard lists, with a documented safe-update workflow that prevents destructive data loss. - Use Case: During a production outage, run an error summary, compare error counts against the previous hour, find the dominant error pattern, then follow the distributed trace ID across services to locate the failing component. ## Quick Start Ask the agent to search Datadog for errors in the api service over the last hour and summarize the top error patterns.

Frequently Asked Questions about datadog-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search Datadog logs from the command line?

Run npx @leoflores/datadog-cli logs search with a --query flag using Datadog query syntax, plus --from and --to time ranges. Add --pretty for human-readable output or --output to export results as JSON.

How do I find all logs for a distributed trace in Datadog?

Use the logs trace command with --id set to the trace ID. It searches both @trace_id and @dd.trace_id attributes across services, and you can widen the window with --from, such as 24h.

What credentials does the Datadog CLI need?

It requires two environment variables: DD_API_KEY and DD_APP_KEY, obtained from the Datadog organization settings API keys page. For non-US sites, pass the --site flag such as datadoghq.eu.

Why did my Datadog dashboard update delete template variables?

The dashboards update command replaces the entire dashboard, so omitted fields like template variables and description are permanently cleared. Always back up with dashboards get --output first, then re-submit all preserved fields during the update.

Can I compare error counts between time periods in Datadog?

Yes, the logs compare command takes a --query and --period flag and shows absolute and percentage change versus the previous period with directional arrows, which helps determine whether an error spike is new.