Datadog logs Search

Datadog logs Search

Certified

Search the Datadog logs

Returns the log events that match a Log Explorer query in a time window. Needs the API key and an application key with the logs_read_data scope.

The events are read page by page until maxResults are collected or Datadog has no more. Datadog applies a rate limit of 300 requests per hour to this endpoint.

yaml
type: io.kestra.plugin.datadog.logs.Search

Fail the flow when a service logged errors in the last 15 minutes

yaml
id: datadog_error_logs
namespace: company.observability

tasks:
  - id: errors
    type: io.kestra.plugin.datadog.logs.Search
    apiKey: "{{ secret('DATADOG_API_KEY') }}"
    appKey: "{{ secret('DATADOG_APP_KEY') }}"
    query: "service:orders status:error"
    from: now-15m
    maxResults: 50

  - id: gate
    type: io.kestra.plugin.core.execution.Assert
    errorMessage: "{{ outputs.errors.size }} error log(s) from orders"
    conditions:
      - "{{ outputs.errors.size == 0 }}"
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-datadog --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

Properties

Datadog API key

The organization API key. Use a Kestra secret, e.g. {{ secret('DATADOG_API_KEY') }}.

API base URL

Replaces https://api.<site> when set, for a proxy, a private link or a test server. Leave it empty for the public API. logs.Send does not use it: it calls the log intake, which has its own address (intakeUrl).

Datadog application key

An application key. Datadog asks for it on every call that reads data or manages monitors and downtimes, so the tasks that only send data (events.Create, metrics.Submit, logs.Send) work without it. Create it with the scopes the task needs. Use a Kestra secret, e.g. {{ secret('DATADOG_APP_KEY') }}.

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

How to return the events

FETCH returns all the events in the output, FETCH_ONE the first one only, STORE writes them to internal storage as an Ion file and returns its uri, NONE returns only size. Use STORE for a large result: the output of a task is kept in the execution and verbose events can reach several MB.

Defaultnow-15m

From

The start of the window: a relative time such as now-15m or now-1d, an ISO-8601 date or a timestamp in milliseconds.

SubTypestring

Indexes

The log indexes to search. All the indexes when it is not set.

Default100

Maximum number of results

Stops after this many log events, between 1 and 10000.

Default*

Query

A Log Explorer query, such as service: orders status: error. All the logs when it is not set.

Datadog site

The Datadog site of the organization, the domain you see in the Datadog URL: datadoghq.com (US1, the default), us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com or ddog-gov.com. A key only works on the site of the organization that created it.

Possible Values
ASCENDINGDESCENDING

Sort order

ASCENDING (oldest first) or DESCENDING (newest first). Datadog uses DESCENDING when it is not set.

Defaultnow

To

The end of the window, in the same formats as from.

SubTypeobject

Log events

With FETCH, the events: id, timestamp, host, service, status, message, tags and attributes (the parsed fields of the log).

First event

With FETCH_ONE, the first event.

Number of events

The number of events found, whatever the fetchType.

Formaturi

Internal storage URI

With STORE, the Ion file that holds the events, one per line.