awscc_logs_metric_filter (Resource)

The AWS::Logs::MetricFilter resource specifies a metric filter that describes how CWL extracts information from logs and transforms it into Amazon CloudWatch metrics. If you have multiple metric filters that are associated with a log group, all the filters are applied to the log streams in that group. The maximum number of metric filters that can be associated with a log group is 100.

Example Usage

Basic example

To create Amazon CloudWatch log metric filter

resource "awscc_logs_metric_filter" "this" {
  filter_name    = "SamplePattern"
  filter_pattern = ""
  log_group_name = awscc_logs_log_group.this.id
  metric_transformations = [{
    metric_name      = "EventCount"
    metric_namespace = "YourNamespace"
    metric_value     = "1"
  }]
}

resource "awscc_logs_log_group" "this" {
  log_group_name    = "SampleLogGroup"
  retention_in_days = 90
  tags = [
    {
      key   = "Name"
      value = "SampleLogGroup"
    },
    {
      key   = "Environment"
      value = "Development"
    },
    {
      key   = "Modified By"
      value = "AWSCC"
    }
  ]
}

Schema

Required

Optional

Read-Only

Nested Schema for metric_transformations

Required:

Optional:

Nested Schema for metric_transformations.dimensions

Required:

Import

Import is supported using the following syntax:

$ terraform import awscc_logs_metric_filter.example <resource ID>