Get a list of logs
GET {{baseUrl}}/api/v2/logs/events
List endpoint returns logs that match a log search query. Results are paginated.
Use this endpoint to see your latest logs.
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.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
filter[query] | string | Search query following logs syntax. | |
filter[indexes] | string | For customers with multiple indexes, the indexes to search. | |
Defaults to '*' which means all indexes | |||
filter[from] | string | Minimum timestamp for requested logs. | |
filter[to] | string | Maximum timestamp for requested logs. | |
filter[storage_tier] | string | Specifies the storage type to be used | |
sort | string | Order of logs in results. | |
page[cursor] | string | List following results with a cursor provided in the previous query. | |
page[limit] | number | Maximum number of logs in the response. |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Accept | string |
RESPONSES
status: OK
{"data":[{"attributes":{"attributes":{"customAttribute":123,"duration":2345},"host":"i-0123","message":"Host connected to remote","service":"agent","status":"INFO","tags":["team:A"],"timestamp":"2019-01-02T09:42:36.320Z"},"id":"AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA","type":"log"},{"attributes":{"attributes":{"customAttribute":123,"duration":2345},"host":"i-0123","message":"Host connected to remote","service":"agent","status":"INFO","tags":["team:A"],"timestamp":"2019-01-02T09:42:36.320Z"},"id":"AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA","type":"log"}],"links":{"next":"https://app.datadoghq.com/api/v2/logs/event?filter[query]=foo\u0026page[cursor]=eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="},"meta":{"elapsed":132,"page":{"after":"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="},"request_id":"MWlFUjVaWGZTTTZPYzM0VXp1OXU2d3xLSVpEMjZKQ0VKUTI0dEYtM3RSOFVR","status":"done","warnings":[{"code":"unknown_index","detail":"indexes: foo, bar","title":"One or several indexes are missing or invalid, results hold data from the other indexes"},{"code":"unknown_index","detail":"indexes: foo, bar","title":"One or several indexes are missing or invalid, results hold data from the other indexes"}]}}