Skip to main content

ddogctl

A modern CLI for the Datadog API. Like Dogshell, but better.

Features

  • Rich terminal output with tables, colors, and progress bars
  • APM trace search and service listing
  • Log querying with trace correlation
  • Database monitoring (DBM) for top queries, query samples, and explain plans
  • Investigation workflows that correlate across monitors, traces, logs, and hosts
  • Retry logic with exponential backoff
  • Region shortcuts (us, eu, us3, us5, ap1, gov)

ddogctl vs Dogshell

Feature ddogctl Dogshell
Rich terminal output Yes No
APM traces Yes No
Log search + correlation Yes No
Database monitoring Yes No
Investigation workflows Yes No
Retry with backoff Yes No
Active maintenance Yes Deprecated

Installation

pip install ddogctl

Or with pipx:

pipx install ddogctl

Or with uv:

uv pip install ddogctl

Configuration

Set the required environment variables:

export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
export DD_SITE="us"  # optional, defaults to datadoghq.com

Personal Access Tokens

ddogctl also accepts a Datadog Personal Access Token (PAT). A PAT is scoped to your user and expires, so you don't need an API key for most commands:

export DD_PAT="ddpat_..."
# or save it in a profile
ddogctl config init --auth pat
ddogctl config set-profile work --pat ddpat_... --site eu

A ddpat_ value in DD_APP_KEY is detected as a PAT too. Commands that send data to Datadog (event post, service-check post) still need DD_API_KEY alongside the PAT.

Database Monitoring access

dbm hosts and dbm queries read the Agent's per-query metrics (mysql.queries.*, postgresql.queries.*), so any credentials that can query metrics work, PATs included. dbm samples and dbm explain read query samples and explain plans through the endpoint in Datadog's DBM API guide, which requires DD_API_KEY plus an unscoped application key. PATs and scoped keys may be rejected with a 403.

Region Shortcuts

Shortcut Site
us datadoghq.com
eu datadoghq.eu
us3 us3.datadoghq.com
us5 us5.datadoghq.com
ap1 ap1.datadoghq.com
gov ddog-gov.com

Quick Start

# Monitors
ddogctl monitor list --state Alert
ddogctl monitor get 12345

# Metrics
ddogctl metric query "avg:system.cpu.user{env:prod}" --from 1h
ddogctl metric search "cpu"

# Events
ddogctl event list --from 1d --priority normal
ddogctl event post "Deployment" "v2.1.0 deployed to prod"

# Hosts
ddogctl host list --filter "env:prod"
ddogctl host info web-prod-01

# APM
ddogctl apm services
ddogctl apm traces my-service --from 1h
ddogctl apm spans search "service:worker @job.name:SyncJob" --field @messaging.destination
ddogctl apm spans search "service:mysql @duration:>1s" --format json   # full span: parent_id, tags, custom attrs
ddogctl apm trace 5501770330737245996                                  # span tree + root span

# Logs
ddogctl logs search "status:error" --service my-api --from 30m
ddogctl logs tail "env:prod" --follow

# Database Monitoring (MySQL, Postgres)
ddogctl dbm hosts --from 24h
ddogctl dbm queries --host db-prod-01 --sort-by avg_latency --from 4h
ddogctl dbm queries --engine mysql --database shop --sort-by lock_time
ddogctl dbm samples 558c51ab1be9812b --limit 20    # needs an unscoped app key
ddogctl dbm explain 558c51ab1be9812b              # needs an unscoped app key

# Investigation Workflows
ddogctl investigate service my-api --from 1h
ddogctl investigate host web-prod-01 --from 30m

Contributing

See CONTRIBUTING.md for setup instructions and development guidelines.

License

MIT

Metadata

Release files for ddogctl 2.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ddogctl 2.4.1
File Size Uploaded
ddogctl-2.4.1.tar.gz 220.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ddogctl 2.4.1
File Interpreter ABI Platform
ddogctl-2.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 296.1 kB

Release files / ddogctl-2.4.1.tar.gz

Download URL ddogctl-2.4.1.tar.gz
Size 220.0 kB
Tags Source
SHA-256 checksum
How to use checksums
321fa9005c333bb7e35bd7934e84e010d2f627d8cb18569f296b0f8d6959e2bf
BLAKE2b-256 checksum
How to use checksums
d8e1f771ebc5ff988f2268afcbe3dd2ea760039c4212455c7e6c158e92b772e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / ddogctl-2.4.1-py3-none-any.whl

Download URL ddogctl-2.4.1-py3-none-any.whl
Size 76.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c943c695c5595b44e83586ffcf9faf5514c8913ae788fb0b455c2e7e23d2a7b
BLAKE2b-256 checksum
How to use checksums
aafc0beee071f7c30cec2fc40c5fc77bed76a72ed4b3f97a23c47a583b097197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.4.1 This release

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page