Skip to content
Software capabilities
Datadog

Search Datadog log events

Use Datadog’s Logs Search API to read matching logs in a fixed time window. To continue, copy meta.page.after from the response into page.cursor on the next request.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. API: POST /api/v2/logs/events/search
  2. Interface: Logs Explorer search
API

POST /api/v2/logs/events/search

Search indexed log events by query, time range, storage tier, and page cursor.

Read source: Datadog search logs API
Requirements
A Datadog API key and an application key with logs_read_data permission for the selected logs, plus the Datadog site domain.
Limitations
Reuse the original search window and sort when passing page.cursor. Resolve relative times to fixed timestamps for a multi-page read.

Example shell

curl --fail -X POST "https://api.$DD_SITE/api/v2/logs/events/search" -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" -H 'Content-Type: application/json' -d '{"filter":{"query":"service:web status:error","from":"2026-11-27T00:00:00Z","to":"2026-11-27T01:00:00Z","indexes":["main"]},"page":{"limit":100}}'
Interface

Logs Explorer search

Use Logs Explorer to apply the same query and time window, inspect facets, and export a bounded result.

Read source: Datadog Logs Explorer search
Requirements
A Datadog user with access to the relevant logs and indexes.
Limitations
The UI view is bounded by the selected time range, retention, and export limits. It does not replace a full archive export.

Example text

Logs → Explorer → query: service:web status:error → time range: past 1 hour