Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow setting dimensions on CloudWatch Metric Filters #57

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = {}
}
Loading