Logs
Search logs (POST)
List endpoint returns logs that match a log search query. Results are paginated.
Use this endpoint to search and filter your 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.
post/api/v2/logs/events/search
Request
- Base URLhttps://api.datadoghq.com
- URLhttps://api.datadoghq.com/api/v2/logs/events/search
- AuthAPI key in header DD-API-KEY and API key in header DD-APPLICATION-KEY
Request body
Example request
{
"filter": {
"from": "now-15m",
"indexes": [
"main",
"web"
],
"query": "service:web* AND @http.status_code:[200 TO 299]",
"storage_tier": "indexes",
"to": "now"
},
"options": {
"timezone": "GMT"
},
"page": {
"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
"limit": 25
}
}Response
OK
Example response
{
"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"
}
],
"links": {
"next": "https://app.datadoghq.com/api/v2/logs/event?filter[query]=foo&page[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"
}
]
}
}Changes
No recorded changes to this operation across all 1 revision of this API.