Skip to content

Commit 72084b3

Browse files
feat: Allow setting dimensions on CloudWatch Metric Filters (#57)
1 parent 60cf981 commit 72084b3

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

modules/log-metric-filter/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ No modules.
3030
|------|-------------|------|---------|:--------:|
3131
| <a name="input_create_cloudwatch_log_metric_filter"></a> [create\_cloudwatch\_log\_metric\_filter](#input\_create\_cloudwatch\_log\_metric\_filter) | Whether to create the Cloudwatch log metric filter | `bool` | `true` | no |
3232
| <a name="input_log_group_name"></a> [log\_group\_name](#input\_log\_group\_name) | The name of the log group to associate the metric filter with | `string` | n/a | yes |
33-
| <a name="input_metric_transformation_default_value"></a> [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 |
33+
| <a name="input_metric_transformation_default_value"></a> [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 |
34+
| <a name="input_metric_transformation_dimensions"></a> [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 |
3435
| <a name="input_metric_transformation_name"></a> [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 |
3536
| <a name="input_metric_transformation_namespace"></a> [metric\_transformation\_namespace](#input\_metric\_transformation\_namespace) | The destination namespace of the CloudWatch metric. | `string` | n/a | yes |
3637
| <a name="input_metric_transformation_unit"></a> [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 |

modules/log-metric-filter/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ resource "aws_cloudwatch_log_metric_filter" "this" {
1111
value = var.metric_transformation_value
1212
default_value = var.metric_transformation_default_value
1313
unit = var.metric_transformation_unit
14+
dimensions = var.metric_transformation_dimensions
1415
}
1516
}

modules/log-metric-filter/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ variable "metric_transformation_value" {
3737
}
3838

3939
variable "metric_transformation_default_value" {
40-
description = "The value to emit when a filter pattern does not match a log event."
40+
description = "The value to emit when a filter pattern does not match a log event. Conflicts with `metric_transformation_dimensions`."
4141
type = string
4242
default = null
4343
}
@@ -47,3 +47,9 @@ variable "metric_transformation_unit" {
4747
type = string
4848
default = null
4949
}
50+
51+
variable "metric_transformation_dimensions" {
52+
description = "The additional dimensions to assign to the metric, in the form `\"name\" = \"$.value\". Conflicts with `metric_transformation_default_value`."
53+
type = map(string)
54+
default = {}
55+
}

0 commit comments

Comments
 (0)