Skip to main content

usage_logs_by_index

Creates, updates, deletes, gets or lists a usage_logs_by_index resource.

Overview

Nameusage_logs_by_index
TypeResource
Iddatadog.organization.usage_logs_by_index

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
index_idstringThe index ID for this usage.
public_idstringThe organization public ID.
index_namestringThe user specified name for this index ID.
org_namestringThe organization name.
event_countinteger (int64)The total number of indexed logs for the queried hour.
hourstring (date-time)The hour for the usage.
retentioninteger (int64)The retention period (in days) for this index ID.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_usage_logs_by_indexselectstart_hrend_hr, index_nameGet hourly usage for logs by index.

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
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.
start_hrstring (date-time)Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
end_hrstring (date-time)Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending before this hour.
index_namearrayComma-separated list of log index names.

SELECT examples

Get hourly usage for logs by index.

SELECT
index_id,
public_id,
index_name,
org_name,
event_count,
hour,
retention
FROM datadog.organization.usage_logs_by_index
WHERE start_hr = '{{ start_hr }}' -- required
AND end_hr = '{{ end_hr }}'
AND index_name = '{{ index_name }}'
;