DataDogClient.aggregateEventsMethod

Function Definition

function aggregateEvents(groupByMissing,
    groupByTotal,
    aggrigation::String,
    interval::String = "",
    metric::String = "",
    type::String = "",
    fromDateTime::String = "",
    indexes::String = "",
    query::String = "",
    storageTier::String = "",
    toDate::String = "",
    facet::String,
    intreval::Double,
    histogramMin::Double,
    histogramMax::Double,
    groupByLimit::Number = -1,
    sortAggrigation::String = "",
    sortMetric::String = "",
    sortOrder::String = "",
    sortType::String = "",
    timeOffset::Number = -1,
    timeZone::String = "",
    pageCursor::String = "")

Parameters

ParameterTypeRequired/Optional
groupByMissingString/Float64[Required]
groupByTotalBoolean/String/Double[Required]
aggrigationString[Required]
intervalString[Optional]
metricString[Optional]
typeString[Optional]
fromDateTimeString[Optional]
indexesString[Optional]
queryString[Optional]
storageTierString[Optional]
toDateString[Optional]
facetString[Optional]
intrevalFloat64[Optional]
histogramMinFloat64[Optional]
histogramMaxFloat64[Optional]
groupByLimitNumber[Optional]
sortAggrigationString[Optional]
sortMetricString[Optional]
sortOrderString[Optional]
sortTypeString[Optional]
timeOffsetNumber[Optional]
timeZoneString[Optional]
pageCursorString[Optional]
Further Resources

See https://docs.datadoghq.com/api/latest/logs/#aggregate-events for official Datadog API documentation

DataDogClient.getListOfLogsMethod

Function Definition

function getListOfLogs(indexFilter::String, fromDate::DateTime, toDate::DateTime, storageTier::Number, pageCursor::String, pageLimit::Number)

Parameters

- query::String       [Optional]
- index::String       [Optional]
- fromDate::String    [Optional]
- toDate::String      [Optional]
- storageTier::String [Optional]
- sort::String        [Optional]
- cursor::String      [Optional]
- pageLimit::Number   [Optional]

API Call Format:

https://api.datadoghq.com/api/v2/logs/events?filter[query]=`<string>`&filter[index]=`<string>`&filter[from]=`<string>`&filter[to]=`<string>`&filter[storage_tier]=`<enum>`&sort=<enum>&page[cursor]=`<string>`&page[limit]=`<integer>`

Query Strings

| Name                 | Type    | Description                                                                                        |
| :------------------- | :------ | :------------------------------------------------------------------------------------------------- |
| filter[query]        | string  | Search query following logs syntax.                                                                |
| filter[index]        | 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] | enum    | Specifies the storage type to be used. Allowed enum values: `indexes`, `online-archives`           |
| sort                 | enum    | Order of logs in results. Allowed enum values: `timestamp`, `-timestamp`                           |
| page[cursor]         | string  | List following results with a cursor provided in the previous query.                               |
| page[limit]          | integer | Maximum number of logs in the response.                                                            |
Note

See https://docs.datadoghq.com/api/latest/logs/#get-a-list-of-logs for more information

DataDogClient.handleMessageMethod
# Function Definition:
    handleMessage(message::String)

## Parameters:
    - message::String [Required]
## Functionality:
    Return a string if the "Message" recieved is not ::Vector{String}
DataDogClient.handleMessageMethod
# Function Definition:
    function handleMessage(message::Vector{String})

## Parameters:
    - message::Vector{String} [Required]

## Functionality:
    Join messages in a string vector into a single string to be compatible with Datadog
DataDogClient.sendLogsFunction

Function Definition:

function sendLogs()

Parameters:

- ddsource::String                       [Optional]
- ddtags::String                         [Optional]
- hostname::String                       [Optional]
- message::Union{String, Vector{String}} [Optional]
- service::String                        [Optional]
NOTE:

Though all parameters are optional according to the API documentation (see "Further Resources" for more information) ddsource and ddtags are required for Datadog to direct logs to the correct application

Functionality:

Send logs to Datadog.

Limits

HTTP request limits:
- Maximum content size per payload (uncompressed): 5MB
- Maximum size for a single log: 1MB
- Maximum array size if sending multiple logs in an array: 1000 entries

Logs exceeding 1MB will be accepted by Datadog but will be truncated
- For a single log request, the API truncates the log at 1MB and returns a 2xx.
- For a multi-logs request, the API processes all logs, truncates only logs larger than 1MB, and returns a 2xx.
- Datadog recommends sending your logs compressed. Add the Content-Encoding: gzip header to the request when sending compressed logs.
Responses:

The status codes answered by the HTTP API are:

  • 202: Accepted: the request has been accepted for processing
  • 400: Bad request (likely an issue in the payload formatting)
  • 401: Unauthorized (likely a missing API Key)
  • 403: Permission issue (likely using an invalid API Key)
  • 408: Request Timeout, request should be retried after some time
  • 413: Payload too large (batch is above 5MB uncompressed)
  • 429: Too Many Requests, request should be retried after some time
  • 500: Internal Server Error, the server encountered an unexpected condition that prevented it from fulfilling the request, request should be retried after some time
  • 503: Service Unavailable, the server is not ready to handle the request probably because it is overloaded, request should be retried after some time

Query Strings:

NameTypeDescription
ddtagsstringLog tags can be passed as query parameters with text/plain content type.

Header Parameters

NameTypeDescription
Content-EncodingstringHTTP header used to compress the media-type.

Body Data (JSON) [Required]

Example Format:
[
    {
    "ddsource": "nginx",
    "ddtags": "env:staging,version:5.1",
    "hostname": "i-012345678",
    "message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World",
    "service": "payment"
    }
]
Further Resources

See https://docs.datadoghq.com/api/latest/logs/#search-logs for official Datadog API documentation