diff --git a/modules/log-metric-filter/README.md b/modules/log-metric-filter/README.md index 19d8ac7..ecf4760 100644 --- a/modules/log-metric-filter/README.md +++ b/modules/log-metric-filter/README.md @@ -30,7 +30,8 @@ No modules. |------|-------------|------|---------|:--------:| | [create\_cloudwatch\_log\_metric\_filter](#input\_create\_cloudwatch\_log\_metric\_filter) | Whether to create the Cloudwatch log metric filter | `bool` | `true` | no | | [log\_group\_name](#input\_log\_group\_name) | The name of the log group to associate the metric filter with | `string` | n/a | yes | -| [metric\_transformation\_default\_value](#input\_metric\_transformation\_default\_value) | The value to emit when a filter pattern does not match a log event. | `string` | `null` | no | +| [metric\_transformation\_default\_value](#input\_metric\_transformation\_default\_value) | The value to emit when a filter pattern does not match a log event. Conflicts with `metric_transformation_dimensions`. | `string` | `null` | no | +| [metric\_transformation\_dimensions](#input\_metric\_transformation\_dimensions) | The additional dimensions to assign to the metric, in the form `"name" = "$.value". Conflicts with `metric\_transformation\_default\_value`.` | `map(string)` | `{}` | no | | [metric\_transformation\_name](#input\_metric\_transformation\_name) | The name of the CloudWatch metric to which the monitored log information should be published (e.g. ErrorCount) | `string` | n/a | yes | | [metric\_transformation\_namespace](#input\_metric\_transformation\_namespace) | The destination namespace of the CloudWatch metric. | `string` | n/a | yes | | [metric\_transformation\_unit](#input\_metric\_transformation\_unit) | The unit to assign to the metric. If you omit this, the unit is set as None. | `string` | `null` | no | diff --git a/modules/log-metric-filter/main.tf b/modules/log-metric-filter/main.tf index 665e019..9bd53f4 100644 --- a/modules/log-metric-filter/main.tf +++ b/modules/log-metric-filter/main.tf @@ -11,5 +11,6 @@ resource "aws_cloudwatch_log_metric_filter" "this" { value = var.metric_transformation_value default_value = var.metric_transformation_default_value unit = var.metric_transformation_unit + dimensions = var.metric_transformation_dimensions } } diff --git a/modules/log-metric-filter/variables.tf b/modules/log-metric-filter/variables.tf index 685c000..9837360 100644 --- a/modules/log-metric-filter/variables.tf +++ b/modules/log-metric-filter/variables.tf @@ -37,7 +37,7 @@ variable "metric_transformation_value" { } variable "metric_transformation_default_value" { - description = "The value to emit when a filter pattern does not match a log event." + description = "The value to emit when a filter pattern does not match a log event. Conflicts with `metric_transformation_dimensions`." type = string default = null } @@ -47,3 +47,9 @@ variable "metric_transformation_unit" { type = string default = null } + +variable "metric_transformation_dimensions" { + description = "The additional dimensions to assign to the metric, in the form `\"name\" = \"$.value\". Conflicts with `metric_transformation_default_value`." + type = map(string) + default = {} +}