All URIs are relative to https://api.datadoghq.com
| Method | HTTP request | Description |
|---|---|---|
| aggregate_logs | POST /api/v2/logs/analytics/aggregate | Aggregate events |
| list_logs | POST /api/v2/logs/events/search | Search logs |
| list_logs_get | GET /api/v2/logs/events | Get a list of logs |
aggregate_logs(body)
The API endpoint to aggregate events into buckets and compute metrics and timeseries.
require 'datadog_api_client'
api_instance = DatadogAPIClient::V2::LogsAPI.new
body = DatadogAPIClient::V2::LogsAggregateRequest.new # LogsAggregateRequest |
begin
# Aggregate events
result = api_instance.aggregate_logs(body)
p result
rescue DatadogAPIClient::V2::APIError => e
puts "Error when calling LogsAPI->aggregate_logs: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> aggregate_logs_with_http_info(body)
begin
# Aggregate events
data, status_code, headers = api_instance.aggregate_logs_with_http_info(body)
p status_code # => 2xx
p headers # => { ... }
p data # => <LogsAggregateResponse>
rescue DatadogAPIClient::V2::APIError => e
puts "Error when calling LogsAPI->aggregate_logs_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| body | LogsAggregateRequest |
- Content-Type: application/json
- Accept: application/json
list_logs(opts)
List endpoint returns logs that match a log search query. Results are paginated.
Use this endpoint to build complex logs filtering and search.
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.
require 'datadog_api_client'
api_instance = DatadogAPIClient::V2::LogsAPI.new
opts = {
body: DatadogAPIClient::V2::LogsListRequest.new # LogsListRequest |
}
begin
# Search logs
result = api_instance.list_logs(opts)
p result
rescue DatadogAPIClient::V2::APIError => e
puts "Error when calling LogsAPI->list_logs: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> list_logs_with_http_info(opts)
begin
# Search logs
data, status_code, headers = api_instance.list_logs_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <LogsListResponse>
rescue DatadogAPIClient::V2::APIError => e
puts "Error when calling LogsAPI->list_logs_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| body | LogsListRequest | [optional] |
- Content-Type: application/json
- Accept: application/json
list_logs_get(opts)
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.
require 'datadog_api_client'
api_instance = DatadogAPIClient::V2::LogsAPI.new
opts = {
filter_query: '@datacenter:us @role:db', # String | Search query following logs syntax.
filter_index: 'main', # String | For customers with multiple indexes, the indexes to search Defaults to '*' which means all indexes
filter_from: Time.parse('2019-01-02T09:42:36.320Z'), # Time | Minimum timestamp for requested logs.
filter_to: Time.parse('2019-01-03T09:42:36.320Z'), # Time | Maximum timestamp for requested logs.
sort: DatadogAPIClient::V2::LogsSort::TIMESTAMP_ASCENDING, # LogsSort | Order of logs in results.
page_cursor: 'eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==', # String | List following results with a cursor provided in the previous query.
page_limit: 25 # Integer | Maximum number of logs in the response.
}
begin
# Get a list of logs
result = api_instance.list_logs_get(opts)
p result
rescue DatadogAPIClient::V2::APIError => e
puts "Error when calling LogsAPI->list_logs_get: #{e}"
endThis returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> list_logs_get_with_http_info(opts)
begin
# Get a list of logs
data, status_code, headers = api_instance.list_logs_get_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <LogsListResponse>
rescue DatadogAPIClient::V2::APIError => e
puts "Error when calling LogsAPI->list_logs_get_with_http_info: #{e}"
end| Name | Type | Description | Notes |
|---|---|---|---|
| filter_query | String | Search query following logs syntax. | [optional] |
| filter_index | String | For customers with multiple indexes, the indexes to search Defaults to '*' which means all indexes | [optional] |
| filter_from | Time | Minimum timestamp for requested logs. | [optional] |
| filter_to | Time | Maximum timestamp for requested logs. | [optional] |
| sort | LogsSort | Order of logs in results. | [optional] |
| page_cursor | String | List following results with a cursor provided in the previous query. | [optional] |
| page_limit | Integer | Maximum number of logs in the response. | [optional][default to 10] |
- Content-Type: Not defined
- Accept: application/json