Configures WAFv2 Web ACL logging with filters to selectively log requests based on specified conditions.

Terraform Template

resource "aws_wafv2_web_acl_logging_configuration" "example" {
  log_destination_configs = ["aws_kinesis_firehose_delivery_stream.example.arn"]

  logging_filter {
    default_behavior = "KEEP"

    filter {
      behavior = "DROP"

      condition {

        action_condition {
          action = "COUNT"
        }
      }

      condition {

        label_name_condition {
          label_name = "awswaf:111122223333:rulegroup:testRules:LabelNameZ"
        }
      }
      requirement = "MEETS_ALL"
    }

    filter {
      behavior = "KEEP"

      condition {

        action_condition {
          action = "ALLOW"
        }
      }
      requirement = "MEETS_ANY"
    }
  }
  resource_arn = "aws_wafv2_web_acl.example.arn"
}