Skip to content

Commit

Permalink
feat: Allow setting dimensions on CloudWatch Metric Filters (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
LawrenceWarren authored Dec 11, 2023
1 parent 60cf981 commit 72084b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/log-metric-filter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ No modules.
|------|-------------|------|---------|:--------:|
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
| <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 |
Expand Down
1 change: 1 addition & 0 deletions modules/log-metric-filter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
8 changes: 7 additions & 1 deletion modules/log-metric-filter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 = {}
}

0 comments on commit 72084b3

Please sign in to comment.