Skip to main content
skill CX Codex

dd-audit-security-investigation — Claude Code skill: setup & overview

Investigates security events in Datadog Audit Trail via pup. Pinpoints who deleted resources, altered permissions, or authenticated from suspicious locations.

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

What dd-audit-security-investigation does

The skill equips the agent with incident investigation workflows centered on pup audit-logs. It executes targeted search queries against Datadog Audit Trail. Payloads are processed with jq to extract user emails, timestamps, and impacted assets.

Coverage spans authentication events, Access Management permission edits, and API key lifecycle events. The instructions guide the model to flag anomalies, such as Datadog support logins (SUPPORT_USER) and sudden bulk resource deletions.

Without pup authenticated via OAuth2 or environment keys DD_API_KEY and DD_APP_KEY holding the audit_logs_read scope, commands fail immediately.

What it helps with

  • identify who deleted or modified a specific Datadog resource
  • inspect failed logins and authentication origins across timeframes
  • audit role updates and access permission changes over 30 days
  • trace recent creation or revocation of API keys

Example prompts for the agent

  • Who deleted Datadog monitors in our account over the last 24 hours?
  • Show all actions taken by [email protected] during the past week using pup audit-logs.
  • Check for failed logins and unexpected locations over the last 7 days.

How to install dd-audit-security-investigation

1Skills CLI (Vercel)

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

2Manually: put the files in place

~/.claude/skills/security-investigation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/security-investigation/

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

Questions about dd-audit-security-investigation

How do I install dd-audit-security-investigation in Claude Code?

Run npx skills add datadog-labs/agent-skills --skill dd-audit-security-investigation -a claude-code in your terminal.

What does dd-audit-security-investigation do?

It guides the agent through querying Datadog Audit Trail logs with pup, helping pinpoint account modifications, access changes, and login patterns.

What prerequisites are needed before running investigations?

You need pup configured via pup auth login, or set DD_API_KEY and DD_APP_KEY with the audit_logs_read scope.

Source text

SKILL.md · MIT
---
name: dd-audit-security-investigation
description: Answer "who did what" security questions from Audit Trail — deletions, config changes, login activity, permission changes, actions from a specific user or IP.
metadata:
  version: "0.1.0"
  author: datadog-labs
  repository: https://github.com/datadog-labs/agent-skills
  tags: datadog,audit,security,investigation,dd-audit
  alwaysApply: "false"
---

# Audit Trail: Security Investigation

Answer common security investigation questions using `pup audit-logs`.

## Prerequisites

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

## Command Execution Order

1. Clarify the investigation scope: who, what resource type, what time window.
2. Run the most specific query first; broaden only if results are empty.
3. If results are large, pipe to `jq` to group or summarize.
4. Highlight anomalies: bulk operations, unusual geo, off-hours activity, support user actions.

## Common Investigation Queries

### Who deleted resources in a time window?

```bash
pup audit-logs search --query "@action:deleted" --from 24h -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      actor_type: .attributes.attributes.evt.actor.type,
      resource_type: .attributes.attributes.asset.type,
      resource_id: .attributes.attributes.asset.id,
      country: .attributes.attributes.network.client.geoip.country.name
    }]'
```

### Who modified a specific resource (by ID)?

```bash
pup audit-logs search --query "@asset.id:RESOURCE_ID" --from 7d -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      action: .attributes.attributes.action,
      event: .attributes.attributes.evt.name
    }]'
```

### What did a specific user do?

```bash
pup audit-logs search --query "@usr.email:[email protected]" --from 7d --limit 200 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      action: .attributes.attributes.action,
      event: .attributes.attributes.evt.name,
      resource_type: .attributes.attributes.asset.type,
      resource_id: .attributes.attributes.asset.id,
      ip: .attributes.attributes.network.client.ip,
      country: .attributes.attributes.network.client.geoip.country.name
    }]'
```

### Login activity — all logins with geo

```bash
pup audit-logs search --query "@evt.name:Authentication @action:login" --from 7d --limit 200 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      status: .attributes.attributes.status,
      ip: .attributes.attributes.network.client.ip,
      city: .attributes.attributes.network.client.geoip.city.name,
      country: .attributes.attributes.network.client.geoip.country.name,
      asn: .attributes.attributes.network.client.geoip.as.name
    }]'
```

### Failed logins only

```bash
pup audit-logs search --query "@evt.name:Authentication @action:login @status:error" --from 7d --limit 200 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      ip: .attributes.attributes.network.client.ip,
      country: .attributes.attributes.network.client.geoip.country.name
    }]'
```

### Who changed roles or permissions?

```bash
pup audit-logs search --query "@evt.name:\"Access Management\"" --from 30d --limit 200 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      action: .attributes.attributes.action,
      resource_type: .attributes.attributes.asset.type,
      resource_id: .attributes.attributes.asset.id
    }]'
```

### What actions came from a specific IP?

```bash
pup audit-logs search --query "@network.client.ip:1.2.3.4" --from 30d --limit 200 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      actor_type: .attributes.attributes.evt.actor.type,
      action: .attributes.attributes.action,
      event: .attributes.attributes.evt.name,
      resource_type: .attributes.attributes.asset.type
    }]'
```

### Who created or deleted API keys?

```bash
pup audit-logs search --query "@evt.name:Authentication @asset.type:api_key" --from 90d --limit 200 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      action: .attributes.attributes.action,
      key_id: .attributes.attributes.asset.id,
      ip: .attributes.attributes.network.client.ip,
      country: .attributes.attributes.network.client.geoip.country.name
    }]'
```

## Event Category Reference

| Category (`@evt.name`) | What it covers |
|------------------------|----------------|
| `Authentication` | Logins, API key create/delete/modify |
| `Access Management` | Roles, user add/remove, restriction policies |
| `Dashboard` | Create, modify, delete, share |
| `Monitor` | Create, modify, delete, resolve |
| `Log Management` | Pipelines, indexes, archives, exclusion filters |
| `Integration` | Add/modify/delete integrations |
| `Metrics` | Custom metric create/modify/delete |
| `Organization Management` | Child org creation, org settings |
| `Notebook` | Create, modify, delete |
| `APM` | Retention filters, sampling config |
| `Cloud Security Platform` | CWS rules, security signal state changes |
| `Bits AI SRE` | MCP tool calls, AI investigations |

## Anomaly Flags to Surface

When presenting investigation results, call out:
- **Actor type `SUPPORT_USER`** — Datadog support accessed the org
- **Bulk deletions** — same user, same action, many resources in a short window
- **Unexpected geography** — country not seen in prior logins for this user
- **Off-hours activity** — actions at unusual times for the user's typical timezone
- **First-time ASN** — action from a cloud provider or VPN not seen before (`@network.client.geoip.as.name`)

## References

- [Audit Trail API](https://docs.datadoghq.com/api/latest/audit/)
- [Audit Trail event categories](https://docs.datadoghq.com/account_management/audit_trail/events/)

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

Similar skills

All skills for Security →

From the same set25

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 agent-observability-session-classify Evaluates user intent satisfaction in Datadog Agent Observability traces and sessions. Returns a compact yes, partial, or no verdict with a brief reason. CX Codex +1 529installs service-remapping A skill for building Datadog APM service remapping rules: collapse noisy inferred entities, clean up auto-generated names, handle renames. CX Codex +1 478installs dd-audit-compliance-report Pulls Datadog Audit Trail events into an auditor-ready report mapped to SOC 2 and PCI DSS controls. CX Codex +1 477installs dd-audit-cost-spike-investigation Correlates a Datadog usage spike with Audit Trail config changes, so you can see who changed what right before the bill jumped. CX Codex +1 473installs upgrade-browser-sdk-v7 Walks a project through the Datadog Browser SDK jump from v6 to v7: stale options, CDN paths, changed APIs. Useful when the upgrade breaks init. CX Codex +1 459installs k9-ownership-byod-setup Builds a Datadog ownership preferences CSV and walks you through uploading it. Useful when the Ownership Agent guesses the wrong resource owners. CX Codex +1 454installs agent-observability-auto-experiment Runs a local improvement loop against real Datadog LLM-Obs data: baseline eval, one focused change, re-score, keep it if the score moves the right way. CX Codex +1 453installs

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