datadog-cli by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill datadog-cli一个供 AI 代理使用的 CLI 工具,用于通过 Datadog 日志和指标进行调试和问题排查。
在使用任何命令前,您必须阅读相关的参考文档:
export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
从以下地址获取密钥:https://app.datadoghq.com/organization-settings/api-keys
npx @leoflores/datadog-cli <command>
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
对于非美国的 Datadog 站点,请使用 --site 标志:
npx @leoflores/datadog-cli logs search --query "*" --site datadoghq.eu
| 命令 | 描述 |
|---|---|
logs search | 使用过滤器搜索日志 |
logs tail | 实时流式传输日志 |
logs trace | 查找分布式追踪的日志 |
logs context | 获取时间戳前后的日志 |
logs patterns | 对相似的日志消息进行分组 |
logs compare | 比较不同时间段内的日志数量 |
logs multi | 并行运行多个查询 |
logs agg | 按属性聚合日志 |
metrics query | 查询时间序列指标 |
errors | 按服务/类型快速查看错误摘要 |
services | 列出有日志活动的服务 |
dashboards | 管理仪表板(增删改查) |
dashboard-lists | 管理仪表板列表 |
npx @leoflores/datadog-cli logs search --query "status:error" --from 1h --pretty
npx @leoflores/datadog-cli logs tail --query "service:api status:error" --pretty
npx @leoflores/datadog-cli errors --from 1h --pretty
npx @leoflores/datadog-cli logs trace --id "abc123def456" --pretty
npx @leoflores/datadog-cli metrics query --query "avg:system.cpu.user{*}" --from 1h --pretty
npx @leoflores/datadog-cli logs compare --query "status:error" --period 1h --pretty
| 标志 | 描述 |
|---|---|
--pretty | 带颜色的人类可读输出 |
--output <file> | 将结果导出到 JSON 文件 |
--site <site> | Datadog 站点(例如 datadoghq.eu) |
30m, 1h, 6h, 24h, 7d2024-01-15T10:30:00Z# 1. 快速错误概览
npx @leoflores/datadog-cli errors --from 1h --pretty
# 2. 这是新错误吗?与上一时间段比较
npx @leoflores/datadog-cli logs compare --query "status:error" --period 1h --pretty
# 3. 查找错误模式
npx @leoflores/datadog-cli logs patterns --query "status:error" --from 1h --pretty
# 4. 按服务缩小范围
npx @leoflores/datadog-cli logs search --query "status:error service:api" --from 1h --pretty
# 5. 获取时间戳前后的上下文
npx @leoflores/datadog-cli logs context --timestamp "2024-01-15T10:30:00Z" --service api --pretty
# 6. 跟踪分布式追踪
npx @leoflores/datadog-cli logs trace --id "TRACE_ID" --pretty
更多调试工作流请参见 workflows.md。
每周安装量
150
代码仓库
GitHub 星标
22.6K
首次出现
2026年1月25日
安全审计
安装于
opencode125
claude-code120
gemini-cli114
codex111
cursor105
github-copilot103
A CLI tool for AI agents to debug and triage using Datadog logs and metrics.
You MUST read the relevant reference docs before using any command:
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
npx @leoflores/datadog-cli <command>
For non-US Datadog sites, use --site flag:
npx @leoflores/datadog-cli logs search --query "*" --site datadoghq.eu
| 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 |
npx @leoflores/datadog-cli logs search --query "status:error" --from 1h --pretty
npx @leoflores/datadog-cli logs tail --query "service:api status:error" --pretty
npx @leoflores/datadog-cli errors --from 1h --pretty
npx @leoflores/datadog-cli logs trace --id "abc123def456" --pretty
npx @leoflores/datadog-cli metrics query --query "avg:system.cpu.user{*}" --from 1h --pretty
npx @leoflores/datadog-cli logs compare --query "status:error" --period 1h --pretty
| Flag | Description |
|---|---|
--pretty | Human-readable output with colors |
--output <file> | Export results to JSON file |
--site <site> | Datadog site (e.g., datadoghq.eu) |
30m, 1h, 6h, 24h, 7d2024-01-15T10:30:00Z# 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.
Weekly Installs
150
Repository
GitHub Stars
22.6K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
opencode125
claude-code120
gemini-cli114
codex111
cursor105
github-copilot103
Azure 升级评估与自动化工具 - 轻松迁移 Functions 计划、托管层级和 SKU
90,800 周安装
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 |