Skip to main content
skill CX Codex

dd-audit — Claude Code skill: Datadog Audit Trail investigations

A skill for Datadog Audit Trail work: who changed what, whether a key was compromised, and what caused a cost spike.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add datadog-labs/agent-skills --skill dd-audit -a claude-code
Open on GitHub

What dd-audit does

dd-audit ships in the datadog-labs/agent-skills repo and drives Audit Trail through pup audit-logs. Five sub-skills sit inside, each for a different job: tracking config changes and user activity, checking whether an API key was compromised, finding the root cause of a usage spike, pulling compliance evidence, and auditing what an AI assistant did with MCP tool calls.

Queries use Lucene syntax, same as Log Explorer: @action:deleted, @usr.email:[email protected], @evt.name:Monitor AND @action:modified. A field reference covers actor, action type, asset, client IP and country, and API path. Output can go to JSON and through jq.

You need auth first: pup auth login over OAuth2, or DD_API_KEY plus DD_APP_KEY with the audit_logs_read scope. Miss that scope and queries come back 403. Retention defaults to 90 days, so anything older has to come from an S3, GCS or Azure Blob archive if one is configured. Worth checking that archive setup before an auditor asks for last year's logs.

What it helps with

  • find who deleted or edited a dashboard in the last day
  • check whether an API key leaked and what it was used for
  • work out why LLM costs jumped
  • gather SOC 2 or PCI evidence for an auditor
  • review which MCP tool calls an AI assistant made

Example prompts for the agent

  • Show me every deletion in the Audit Trail from the last 24 hours
  • Check whether key key_abc123 was compromised and what it did
  • Pull user provisioning logs for the SOC 2 auditor

How to install dd-audit

1Skills CLI (Vercel)

npx skills add datadog-labs/agent-skills --skill dd-audit -a claude-code

2Manually: put the files in place

~/.claude/skills/dd-audit/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/dd-audit/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about dd-audit

How do I install dd-audit in Claude?

Run npx skills add datadog-labs/agent-skills --skill dd-audit -a claude-code. The skill lands at ~/.claude/skills/dd-audit/SKILL.md.

What does dd-audit do?

It investigates Datadog Audit Trail through pup audit-logs: config changes, a single user's activity, signs of key compromise, and the cause of a cost spike. One sub-skill assembles SOC 2 and PCI evidence.

What does dd-audit need to work?

Auth via pup auth login over OAuth2, or DD_API_KEY and DD_APP_KEY with the audit_logs_read scope. Without that scope, queries return 403.

Source text

SKILL.md · MIT
---
name: dd-audit
description: Audit Trail investigations - who changed what, key compromise, cost spike root cause, compliance evidence (SOC 2/PCI), and AI activity auditing.
metadata:
  version: "0.1.0"
  author: datadog-labs
  repository: https://github.com/datadog-labs/agent-skills
  tags: datadog,audit,audit-trail,security,compliance,dd-audit
  alwaysApply: "false"
---

# Datadog Audit Trail

Investigate user activity, configuration changes, access patterns, and compliance evidence using `pup audit-logs`.

## Sub-Skills

| Sub-skill | Use when |
|-----------|----------|
| **security-investigation** | "Who changed X?", "What did this user do?", "Show me deletions in the last 24h" |
| **key-compromise** | "Was this API key compromised?", "What did key XYZ do?", "Investigate suspicious key activity" |
| **cost-spike-investigation** | "Why did my bill go up?", "What caused this usage spike?", "Investigate LLM cost increase" |
| **compliance-report** | "Generate SOC 2 evidence", "PCI audit log", "User provisioning report for auditor" |
| **ai-activity-audit** | "What did the AI assistant do?", "Audit MCP tool calls", "AI governance report" |

## Prerequisites

```bash
pup auth login   # OAuth2 (recommended)
# or set DD_API_KEY + DD_APP_KEY with audit_logs_read scope
```

## Commands

```bash
# List recent events
pup audit-logs list --from 1h --limit 100

# Search with a query
pup audit-logs search --query "@action:deleted" --from 24h

# JSON output for piping to jq
pup audit-logs search --query "@usr.email:[email protected]" --from 7d -o json | jq '.data[].attributes'
```

## Event Schema Quick Reference

| Field | Description | Example values |
|-------|-------------|----------------|
| `@usr.email` | Actor email | `[email protected]` |
| `@evt.actor.type` | How action was taken | `USER`, `API_KEY`, `SUPPORT_USER` |
| `@action` | Verb | `created`, `modified`, `deleted`, `accessed`, `login` |
| `@evt.name` | Event category | `Dashboard`, `Monitor`, `Authentication`, `Access Management` |
| `@asset.type` | Resource type | `dashboard`, `monitor`, `api_key`, `role`, `user` |
| `@asset.id` | Resource identifier | `abc-123` |
| `@metadata.api_key.id` | API key used (if applicable) | `key_abc123` |
| `@metadata.app_key.id` | App key used (if applicable) | `app_abc123` |
| `@network.client.ip` | Client IP address | `1.2.3.4` |
| `@network.client.geoip.country.name` | Country | `United States` |
| `@network.client.geoip.as.name` | ASN name | `Amazon.com` |
| `@http.url_details.path` | API endpoint path | `/api/v1/dashboard/xyz` |

## Search Syntax

Same Lucene-style syntax as Log Explorer:

| Query | Meaning |
|-------|---------|
| `@evt.name:Dashboard` | Exact field match |
| `@action:deleted` | Action filter |
| `@usr.email:[email protected]` | Specific user |
| `@evt.name:Monitor AND @action:modified` | Compound |
| `-@action:deleted` | Negation |
| `@usr.email:*` | Field exists |
| `@network.client.ip:1.2.3.4` | IP filter |

## Retention

Default retention is **90 days**. If querying beyond 90 days, archive to S3/GCS/Azure Blob must be configured. Always check whether the requested time window falls within retention before running a query.

## Troubleshooting

| Problem | Cause | Fix |
|---------|-------|-----|
| 403 Forbidden | Missing `audit_logs_read` scope | Add scope to app key in Datadog UI |
| Empty results | Time window outside retention | Check archive config; default max is 90 days |
| Timeout | Query too broad | Narrow time window or add more filters |
| No IP data | Internal action or pre-enrichment event | Not all events have geo data |

## References

- [Audit Trail API](https://docs.datadoghq.com/api/latest/audit/)
- [Audit Trail documentation](https://docs.datadoghq.com/account_management/audit_trail/)
- [Search syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/)

© datadog-labs · MIT · datadog-labs/agent-skills

Similar skills

Everything for Security →

From the same set20

agent-skills A set of Datadog skills for AI agents: logs, traces, monitors, cloud integrations. Useful when the agent has to handle observability work itself. CX Codex +1 2,600installs dd-logs A skill for working with Datadog logs through the CLI: search, archives, log-based metrics and exclusion filters for cost control. Useful when you are chasing an incident or trimming an indexing bill. CX Codex +1 2,100installs dd-apm A skill for Datadog APM work: agent install, auto-instrumentation, trace digging and queue monitoring. Useful when the service is already in Datadog and you forgot where to start. CX Codex +1 2,000installs dd-monitors A skill for managing Datadog monitors: list, search, create from a file, and alerting rules that keep noise down. CX Codex +1 1,900installs dd-browser-sdk Routes coding agents through Datadog Browser SDK upgrades from v4 to v7 and automates sourcemap uploads across major bundlers. CX Codex +1 577installs agent-observability-trace-rca Walks production LLM traces from symptom to root cause. Useful when evals start failing or runtime errors pile up and you need to know why. CX Codex +1 552installs agent-observability-eval-bootstrap Generates LLM evaluation suites from Datadog production traces. Creates inactive online judge drafts, offline Python SDK code, or JSON datasets. CX Codex +1 547installs agent-observability-eval-pipeline Walks an instrumented ml_app through six phases: classify traces, root-cause failures, bootstrap evaluators, build a dataset, run an experiment, analyze it. CX Codex +1 540installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor