Provides a Logz.io metrics rollup rules resource. This allows you to manage metrics rollup rules in your Logz.io account.
resource "logzio_metrics_rollup_rules" "cpu_usage_rollup" {
account_id = 123456
metric_name = "cpu_usage"
metric_type = "GAUGE"
rollup_function = "LAST"
labels_elimination_method = "EXCLUDE_BY"
labels = ["instance_id", "process_id"]
}resource "logzio_metrics_rollup_rules" "frontend_metrics_rollup" {
account_id = 123456
name = "Frontend Service Metrics"
metric_type = "COUNTER"
rollup_function = "SUM"
labels_elimination_method = "GROUP_BY"
labels = ["service", "region"]
filter {
expression {
comparison = "EQ"
name = "service"
value = "frontend"
}
expression {
comparison = "REGEX_MATCH"
name = "region"
value = "us-.*"
}
}
new_metric_name_template = "rollup.frontend.{{metricName}}"
drop_original_metric = true
}resource "logzio_metrics_rollup_rules" "response_time_rollup" {
account_id = 123456
metric_name = "http_response_time"
metric_type = "MEASUREMENT"
rollup_function = "P95"
labels_elimination_method = "EXCLUDE_BY"
labels = ["endpoint", "method"]
}The following arguments are supported:
account_id- (Required) The metrics account ID for the metrics rollup rule.metric_name- (Optional) The name of the metric for which to create the rollup rule. Eithermetric_nameorfiltermust be specified, but not both.metric_type- (Required) The type of the metric. Valid values areGAUGE,COUNTER,DELTA_COUNTER,CUMULATIVE_COUNTER, andMEASUREMENT.rollup_function- The aggregation function to use for rolling up the metric. Required for all metric types. ForCOUNTER,DELTA_COUNTER, andCUMULATIVE_COUNTERtypes, must beSUM. ForMEASUREMENTandGAUGEmetric types, any valid aggregation function is allowed. Valid values includeSUM,MIN,MAX,COUNT,LAST,MEAN,MEDIAN,STDEV,SUMSQ, and percentiles (P10,P20,P25,P30,P40,P50,P60,P70,P75,P80,P90,P95,P99,P999,P9999).labels_elimination_method- (Required) The method for eliminating labels. Valid values areEXCLUDE_BYandGROUP_BY.labels- (Required) A list of label names to be eliminated from the metric.name- (Optional) A human-readable name for the rollup rule.filter- (Optional) A filter block to match metrics by label values. Eithermetric_nameorfiltermust be specified, but not both.expression- (Required) A list of filter expressions.comparison- (Required) The comparison operator. Valid values areEQ,NOT_EQ,REGEX_MATCH, andREGEX_NO_MATCH.name- (Required) The label name to match against.value- (Required) The value to match.
new_metric_name_template- (Optional) A template for generating new metric names. Use{{metricName}}to reference the original metric name.drop_original_metric- (Optional) Whether to drop the original metric after creating the rollup. Defaults tofalse.
In addition to all arguments above, the following attributes are exported:
id- The ID of the metrics rollup rule.
Metrics rollup rules can be imported using their ID:
terraform import logzio_metrics_rollup_rules.my_rollup_rule "rule_id"