metrics
Creates, updates, deletes, gets or lists a metrics
resource.
Overview
Name | metrics |
Type | Resource |
Id | datadog.logs.metrics |
Fields
The following fields are returned by SELECT
queries:
- get_logs_metric
- list_logs_metrics
Name | Datatype | Description |
---|---|---|
id | string | The name of the log-based metric. (example: logs.page.load.count) |
attributes | object | The object describing a Datadog log-based metric. |
type | string | The type of the resource. The value should always be logs_metrics. (default: logs_metrics, example: logs_metrics) |
Name | Datatype | Description |
---|---|---|
id | string | The name of the log-based metric. (example: logs.page.load.count) |
attributes | object | The object describing a Datadog log-based metric. |
type | string | The type of the resource. The value should always be logs_metrics. (default: logs_metrics, example: logs_metrics) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_logs_metric | select | metric_id , region | Get a specific log-based metric from your organization. | |
list_logs_metrics | select | region | Get the list of configured log-based metrics with their definitions. | |
create_logs_metric | insert | region , data__data | Create a metric based on your ingested logs in your organization. Returns the log-based metric object from the request body when the request is successful. | |
update_logs_metric | update | metric_id , region , data__data | Update a specific log-based metric from your organization. Returns the log-based metric object from the request body when the request is successful. | |
delete_logs_metric | delete | metric_id , region | Delete a specific log-based metric from your organization. |
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.
Name | Datatype | Description |
---|---|---|
metric_id | string | The name of the log-based metric. |
region | string | (default: datadoghq.com) |
SELECT
examples
- get_logs_metric
- list_logs_metrics
Get a specific log-based metric from your organization.
SELECT
id,
attributes,
type
FROM datadog.logs.metrics
WHERE metric_id = '{{ metric_id }}' -- required
AND region = '{{ region }}' -- required
;
Get the list of configured log-based metrics with their definitions.
SELECT
id,
attributes,
type
FROM datadog.logs.metrics
WHERE region = '{{ region }}' -- required
;
INSERT
examples
- create_logs_metric
- Manifest
Create a metric based on your ingested logs in your organization.
Returns the log-based metric object from the request body when the request is successful.
INSERT INTO datadog.logs.metrics (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data
;
# Description fields are for documentation purposes
- name: metrics
props:
- name: region
value: string
description: Required parameter for the metrics resource.
- name: data
value: object
description: |
The new log-based metric properties.
UPDATE
examples
- update_logs_metric
Update a specific log-based metric from your organization.
Returns the log-based metric object from the request body when the request is successful.
UPDATE datadog.logs.metrics
SET
data__data = '{{ data }}'
WHERE
metric_id = '{{ metric_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data;
DELETE
examples
- delete_logs_metric
Delete a specific log-based metric from your organization.
DELETE FROM datadog.logs.metrics
WHERE metric_id = '{{ metric_id }}' --required
AND region = '{{ region }}' --required
;