Resource for interacting with the logs_metric API
resource "datadog_logs_metric" "testing_logs_metric" {
name = "testing.logs.metric"
compute {
aggregation_type = "distribution"
path = "@duration"
}
filter {
query = "service:test"
}
group_by {
path = "@status"
tag_name = "status"
}
group_by {
path = "@version"
tag_name = "version"
}
}
compute
(Block List, Min: 1, Max: 1) The compute rule to compute the log-based metric. This field can't be updated after creation. (see below for nested schema)filter
(Block List, Min: 1, Max: 1) The log-based metric filter. Logs matching this filter will be aggregated in this metric. (see below for nested schema)name
(String) The name of the log-based metric. This field can't be updated after creation.group_by
(Block Set) The rules for the group by. (see below for nested schema)id
(String) The ID of this resource.compute
Required:
aggregation_type
(String) The type of aggregation to use. This field can't be updated after creation. Valid values are count
, distribution
.Optional:
include_percentiles
(Boolean) Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an aggregation_type
of distribution.path
(String) The path to the value the log-based metric will aggregate on (only used if the aggregation type is a "distribution"). This field can't be updated after creation.filter
Required:
query
(String) The search query - following the log search syntax.group_by
Required:
path
(String) The path to the value the log-based metric will be aggregated over.tag_name
(String) Name of the tag that gets created.Import is supported using the following syntax:
terraform import datadog_logs_metric.testing_logs_metric testing.logs.metric