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
Metadata
Release files for ddogctl 2.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ddogctl-2.4.0.tar.gz | 218.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ddogctl-2.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 294.0 kB
Release files / ddogctl-2.4.0.tar.gz
| Download URL | ddogctl-2.4.0.tar.gz |
|---|---|
| Size | 218.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ac30894055599c4ca46636e436b4ae8a86e74330fd703bf8df116f7fdf48020
|
|
BLAKE2b-256 checksum How to use checksums |
7158cfcd9aeae140d1d52cc972f6802c11b281820cb562e6b7678b5e0dba350f
|
| 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 logRelease files / ddogctl-2.4.0-py3-none-any.whl
| Download URL | ddogctl-2.4.0-py3-none-any.whl |
|---|---|
| Size | 75.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8616265ee64b147302f942d8b6969a1caa07d4070d14b9ec6ea3771b04a5dcb8
|
|
BLAKE2b-256 checksum How to use checksums |
efa7ad0752affa6cba74d009449f079aa39d76cd3292799c0769417f50aeccff
|
| 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