跳到正文
Skillpedia
部署与云(DevOps)33k · #8541

datadog-cli

它能做什么

这个技能为 AI 智能体提供 Datadog 的命令行工具。Datadog 是一项监控服务。适合需要调试或分诊生产问题的开发者和值班工程师。

适用场景

  • ✓当需要快速在日志中找到生产错误的时候。
  • ✓当团队想要追踪跨服务的一个缓慢或失败请求的时候。
  • ✓当需要检查或创建 Datadog 中的指标或仪表板的时候。

技能链接

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/ai-research/datadog-cli/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/ai-research/datadog-cli/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在 Datadog 日志中搜索过去一小时结账服务的错误,并总结原因。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能运行一个命令行工具,使用你的 Datadog 密钥搜索日志、查询指标,并按服务汇总错误。你必须先设置 API 密钥和应用密钥才能连接。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Datadog CLI

A CLI tool for AI agents to debug and triage using Datadog logs and metrics.

Required Reading

You MUST read the relevant reference docs before using any command:

Setup

Environment Variables (Required)

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

Running the CLI

npx @leoflores/datadog-cli <command>

For non-US Datadog sites, use --site flag:

npx @leoflores/datadog-cli logs search --query "*" --site datadoghq.eu

Commands Overview

Command Description
logs search Search logs with filters
logs tail Stream logs in real-time
logs trace Find logs for a distributed trace
logs context Get logs before/after a timestamp
logs patterns Group similar log messages
logs compare Compare log counts between periods
logs multi Run multiple queries in parallel
logs agg Aggregate logs by facet
metrics query Query timeseries metrics
errors Quick error summary by service/type
services List services with log activity
dashboards Manage dashboards (CRUD)
dashboard-lists Manage dashboard lists

Quick Examples

Search Errors

npx @leoflores/datadog-cli logs search --query "status:error" --from 1h --pretty

Tail Logs (Real-time)

npx @leoflores/datadog-cli logs tail --query "service:api status:error" --pretty

Error Summary

npx @leoflores/datadog-cli errors --from 1h --pretty

Trace Correlation

npx @leoflores/datadog-cli logs trace --id "abc123def456" --pretty

Query Metrics

npx @leoflores/datadog-cli metrics query --query "avg:system.cpu.user{*}" --from 1h --pretty

Compare Periods

npx @leoflores/datadog-cli logs compare --query "status:error" --period 1h --pretty

Global Flags

Flag Description
--pretty Human-readable output with colors
--output <file> Export results to JSON file
--site <site> Datadog site (e.g., datadoghq.eu)

Time Formats

  • Relative: 30m, 1h, 6h, 24h, 7d
  • ISO 8601: 2024-01-15T10:30:00Z

Incident Triage Workflow

# 1. Quick error overview
npx @leoflores/datadog-cli errors --from 1h --pretty

# 2. Is this new? Compare to previous period
npx @leoflores/datadog-cli logs compare --query "status:error" --period 1h --pretty

# 3. Find error patterns
npx @leoflores/datadog-cli logs patterns --query "status:error" --from 1h --pretty

# 4. Narrow down by service
npx @leoflores/datadog-cli logs search --query "status:error service:api" --from 1h --pretty

# 5. Get context around a timestamp
npx @leoflores/datadog-cli logs context --timestamp "2024-01-15T10:30:00Z" --service api --pretty

# 6. Follow the distributed trace
npx @leoflores/datadog-cli logs trace --id "TRACE_ID" --pretty

See workflows.md for more debugging workflows.

常见问题

我需要设置什么?

你需要以环境变量的形式设置 Datadog API 密钥和应用密钥。

它可以使用非美国区域的 Datadog 站点吗?

可以。站点选项可以让它连接到其他 Datadog 区域。

它会改变我的生产系统吗?

该技能用于搜索和查询数据,例如日志、指标和错误。

详情

作者的原始描述

Datadog CLI for searching logs, querying metrics, tracing requests, and managing dashboards. Use this when debugging production issues or working with Datadog observability.

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#8541
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能