v1

latestOpenAPI 3.0.02026-07-142351,1971.3 MB
Logs

Search logs

List endpoint returns logs that match a log search query. Results are paginated.

If you are considering archiving logs for your organization, consider use of the Datadog archive capabilities instead of the log list API. See Datadog Logs Archive documentation.

Note: This endpoint is enabled by default for logs customers. To disable it, contact Datadog support.

post/api/v1/logs-queries/list

Request body

indexstring

The log index on which the request is performed. For multi-index organizations, the default is all live indexes. Historical indexes of rehydrated logs must be specified.

limitinteger

Number of logs return in the response.

querystring

The search query - following the log search syntax.

sort'asc' | 'desc'

Time-ascending asc or time-descending desc results.

startAtstring

Hash identifier of the first log to return in the list, available in a log id attribute. This parameter is used for the pagination feature.

Note: This parameter is ignored if the corresponding log is out of the scope of the specified time window.

Example request

{
  "index": "retention-3,retention-15",
  "query": "service:web* AND @http.status_code:[200 TO 299]",
  "time": {
    "from": "2020-02-02T02:02:02.202Z",
    "to": "2020-02-20T02:02:02.202Z"
  }
}

Response

OK

nextLogIdstring nullable

Hash identifier of the next log to return in the list. This parameter is used for the pagination feature.

statusstring

Status of the response.

Example response

{
  "logs": [
    {
      "content": {
        "attributes": {
          "customAttribute": 123,
          "duration": 2345
        },
        "host": "i-0123",
        "message": "Host connected to remote",
        "service": "agent",
        "tags": [
          "team:A"
        ],
        "timestamp": "2020-05-26T13:36:14Z"
      },
      "id": "AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA"
    }
  ]
}