Skip to main content

indexes

Creates, updates, deletes, gets or lists an indexes resource.

Overview

Nameindexes
TypeResource
Iddatadog.logs.indexes

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the index. (example: main)
daily_limitinteger (int64)The number of log events you can send in this index per day before you are rate-limited.
daily_limit_resetobjectObject containing options to override the default daily limit reset time.
daily_limit_warning_threshold_percentagenumber (double)A percentage threshold of the daily quota at which a Datadog warning event is generated.
exclusion_filtersarrayAn array of exclusion objects. The logs are tested against the query of each filter, following the order of the array. Only the first matching active exclusion matters, others (if any) are ignored.
filterobjectFilter for logs.
is_rate_limitedbooleanA boolean stating if the index is rate limited, meaning more logs than the daily limit have been sent. Rate limit is reset every-day at 2pm UTC.
num_flex_logs_retention_daysinteger (int64)The total number of days logs are stored in Standard and Flex Tier before being deleted from the index. If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through num_retention_days, and then stored in Flex Tier until the number of days specified in num_flex_logs_retention_days is reached. The available values depend on retention plans specified in your organization's contract/subscriptions.
num_retention_daysinteger (int64)The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index. The available values depend on retention plans specified in your organization's contract/subscriptions.
tagsarrayA list of tags associated with the index. Tags must be in key:value format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_logs_indexselectnameGet one log index from your organization. This endpoint takes no JSON arguments.
list_log_indexesselectThe Index object describes the configuration of a log index.<br />This endpoint returns an array of the LogIndex objects of your organization.
create_logs_indexinsertname, filterCreates a new index. Returns the Index object passed in the request body when the request is successful.
update_logs_indexreplacename, filterUpdate an index as identified by its name.<br />Returns the Index object passed in the request body when the request is successful.<br /><br />Using the PUT method updates your index's configuration by replacing<br />your current configuration with the new one sent to your Datadog organization.
delete_logs_indexdeletenameDelete an existing index from your organization. Index deletions are permanent and cannot be reverted.<br />You cannot recreate an index with the same name as deleted ones.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
namestringName of the log index.
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.

SELECT examples

Get one log index from your organization. This endpoint takes no JSON arguments.

SELECT
name,
daily_limit,
daily_limit_reset,
daily_limit_warning_threshold_percentage,
exclusion_filters,
filter,
is_rate_limited,
num_flex_logs_retention_days,
num_retention_days,
tags
FROM datadog.logs.indexes
WHERE name = '{{ name }}' -- required
;

INSERT examples

Creates a new index. Returns the Index object passed in the request body when the request is successful.

INSERT INTO datadog.logs.indexes (
daily_limit,
daily_limit_reset,
daily_limit_warning_threshold_percentage,
exclusion_filters,
filter,
name,
num_flex_logs_retention_days,
num_retention_days,
tags
)
SELECT
{{ daily_limit }},
'{{ daily_limit_reset }}',
{{ daily_limit_warning_threshold_percentage }},
'{{ exclusion_filters }}',
'{{ filter }}' /* required */,
'{{ name }}' /* required */,
{{ num_flex_logs_retention_days }},
{{ num_retention_days }},
'{{ tags }}'
RETURNING
name,
daily_limit,
daily_limit_reset,
daily_limit_warning_threshold_percentage,
exclusion_filters,
filter,
is_rate_limited,
num_flex_logs_retention_days,
num_retention_days,
tags
;

REPLACE examples

Update an index as identified by its name.<br />Returns the Index object passed in the request body when the request is successful.<br /><br />Using the PUT method updates your index's configuration by replacing<br />your current configuration with the new one sent to your Datadog organization.

REPLACE datadog.logs.indexes
SET
daily_limit = {{ daily_limit }},
daily_limit_reset = '{{ daily_limit_reset }}',
daily_limit_warning_threshold_percentage = {{ daily_limit_warning_threshold_percentage }},
disable_daily_limit = {{ disable_daily_limit }},
exclusion_filters = '{{ exclusion_filters }}',
filter = '{{ filter }}',
num_flex_logs_retention_days = {{ num_flex_logs_retention_days }},
num_retention_days = {{ num_retention_days }},
tags = '{{ tags }}'
WHERE
name = '{{ name }}' --required
AND filter = '{{ filter }}' --required
RETURNING
name,
daily_limit,
daily_limit_reset,
daily_limit_warning_threshold_percentage,
exclusion_filters,
filter,
is_rate_limited,
num_flex_logs_retention_days,
num_retention_days,
tags;

DELETE examples

Delete an existing index from your organization. Index deletions are permanent and cannot be reverted.<br />You cannot recreate an index with the same name as deleted ones.

DELETE FROM datadog.logs.indexes
WHERE name = '{{ name }}' --required
;