WebAclLoggingConfiguration class

This resource creates a WAFv2 Web ACL Logging Configuration.

> WARNING: When logging from a WAFv2 Web ACL to a CloudWatch Log Group, the WAFv2 service tries to create or update a generic Log Resource Policy named AWSWAF-LOGS. However, if there are a large number of Web ACLs or if the account frequently creates and deletes Web ACLs, this policy may exceed the maximum policy size. As a result, this resource type will fail to be created. More details about this issue can be found in this issue. To prevent this issue, you can manage a specific resource policy. Please refer to the example below for managing a CloudWatch Log Group with a managed CloudWatch Log Resource Policy.

Example Usage

With Redacted Fields

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.wafv2.WebAclLoggingConfiguration("example", {
    redactedFields: [{
        singleHeader: {
            name: "user-agent",
        },
    }],
    logDestinationConfigs: [exampleAwsKinesisFirehoseDeliveryStream.arn],
    resourceArn: exampleAwsWafv2WebAcl.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.wafv2.WebAclLoggingConfiguration("example",
    redacted_fields=[{
        "single_header": {
            "name": "user-agent",
        },
    }],
    log_destination_configs=[example_aws_kinesis_firehose_delivery_stream["arn"]],
    resource_arn=example_aws_wafv2_web_acl["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.WafV2.WebAclLoggingConfiguration("example", new()
    {
        RedactedFields = new[]
        {
            new Aws.WafV2.Inputs.WebAclLoggingConfigurationRedactedFieldArgs
            {
                SingleHeader = new Aws.WafV2.Inputs.WebAclLoggingConfigurationRedactedFieldSingleHeaderArgs
                {
                    Name = "user-agent",
                },
            },
        },
        LogDestinationConfigs = new[]
        {
            exampleAwsKinesisFirehoseDeliveryStream.Arn,
        },
        ResourceArn = exampleAwsWafv2WebAcl.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/wafv2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := wafv2.NewWebAclLoggingConfiguration(ctx, "example", &wafv2.WebAclLoggingConfigurationArgs{
			RedactedFields: wafv2.WebAclLoggingConfigurationRedactedFieldArray{
				&wafv2.WebAclLoggingConfigurationRedactedFieldArgs{
					SingleHeader: &wafv2.WebAclLoggingConfigurationRedactedFieldSingleHeaderArgs{
						Name: pulumi.String("user-agent"),
					},
				},
			},
			LogDestinationConfigs: pulumi.StringArray{
				exampleAwsKinesisFirehoseDeliveryStream.Arn,
			},
			ResourceArn: pulumi.Any(exampleAwsWafv2WebAcl.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_wafv2_webaclloggingconfiguration" "example" {
  redacted_fields {
    single_header = {
      name = "user-agent"
    }
  }
  log_destination_configs = [exampleAwsKinesisFirehoseDeliveryStream.arn]
  resource_arn            = exampleAwsWafv2WebAcl.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.wafv2.WebAclLoggingConfiguration;
import com.pulumi.aws.wafv2.WebAclLoggingConfigurationArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationRedactedFieldArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationRedactedFieldSingleHeaderArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new WebAclLoggingConfiguration("example", WebAclLoggingConfigurationArgs.builder()
            .redactedFields(WebAclLoggingConfigurationRedactedFieldArgs.builder()
                .singleHeader(WebAclLoggingConfigurationRedactedFieldSingleHeaderArgs.builder()
                    .name("user-agent")
                    .build())
                .build())
            .logDestinationConfigs(exampleAwsKinesisFirehoseDeliveryStream.arn())
            .resourceArn(exampleAwsWafv2WebAcl.arn())
            .build());

    }
}
resources:
  example:
    type: aws:wafv2:WebAclLoggingConfiguration
    properties:
      redactedFields:
        - singleHeader:
            name: user-agent
      logDestinationConfigs:
        - ${exampleAwsKinesisFirehoseDeliveryStream.arn}
      resourceArn: ${exampleAwsWafv2WebAcl.arn}

With Logging Filter

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.wafv2.WebAclLoggingConfiguration("example", {
    loggingFilter: {
        filters: [
            {
                conditions: [
                    {
                        actionCondition: {
                            action: "COUNT",
                        },
                    },
                    {
                        labelNameCondition: {
                            labelName: "awswaf:111122223333:rulegroup:testRules:LabelNameZ",
                        },
                    },
                ],
                behavior: "DROP",
                requirement: "MEETS_ALL",
            },
            {
                conditions: [{
                    actionCondition: {
                        action: "ALLOW",
                    },
                }],
                behavior: "KEEP",
                requirement: "MEETS_ANY",
            },
        ],
        defaultBehavior: "KEEP",
    },
    logDestinationConfigs: [exampleAwsKinesisFirehoseDeliveryStream.arn],
    resourceArn: exampleAwsWafv2WebAcl.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.wafv2.WebAclLoggingConfiguration("example",
    logging_filter={
        "filters": [
            {
                "conditions": [
                    {
                        "action_condition": {
                            "action": "COUNT",
                        },
                    },
                    {
                        "label_name_condition": {
                            "label_name": "awswaf:111122223333:rulegroup:testRules:LabelNameZ",
                        },
                    },
                ],
                "behavior": "DROP",
                "requirement": "MEETS_ALL",
            },
            {
                "conditions": [{
                    "action_condition": {
                        "action": "ALLOW",
                    },
                }],
                "behavior": "KEEP",
                "requirement": "MEETS_ANY",
            },
        ],
        "default_behavior": "KEEP",
    },
    log_destination_configs=[example_aws_kinesis_firehose_delivery_stream["arn"]],
    resource_arn=example_aws_wafv2_web_acl["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.WafV2.WebAclLoggingConfiguration("example", new()
    {
        LoggingFilter = new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterArgs
        {
            Filters = new[]
            {
                new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterArgs
                {
                    Conditions = new[]
                    {
                        new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs
                        {
                            ActionCondition = new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs
                            {
                                Action = "COUNT",
                            },
                        },
                        new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs
                        {
                            LabelNameCondition = new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionLabelNameConditionArgs
                            {
                                LabelName = "awswaf:111122223333:rulegroup:testRules:LabelNameZ",
                            },
                        },
                    },
                    Behavior = "DROP",
                    Requirement = "MEETS_ALL",
                },
                new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterArgs
                {
                    Conditions = new[]
                    {
                        new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs
                        {
                            ActionCondition = new Aws.WafV2.Inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs
                            {
                                Action = "ALLOW",
                            },
                        },
                    },
                    Behavior = "KEEP",
                    Requirement = "MEETS_ANY",
                },
            },
            DefaultBehavior = "KEEP",
        },
        LogDestinationConfigs = new[]
        {
            exampleAwsKinesisFirehoseDeliveryStream.Arn,
        },
        ResourceArn = exampleAwsWafv2WebAcl.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/wafv2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := wafv2.NewWebAclLoggingConfiguration(ctx, "example", &wafv2.WebAclLoggingConfigurationArgs{
			LoggingFilter: &wafv2.WebAclLoggingConfigurationLoggingFilterArgs{
				Filters: wafv2.WebAclLoggingConfigurationLoggingFilterFilterArray{
					&wafv2.WebAclLoggingConfigurationLoggingFilterFilterArgs{
						Conditions: wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionArray{
							&wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs{
								ActionCondition: &wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs{
									Action: pulumi.String("COUNT"),
								},
							},
							&wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs{
								LabelNameCondition: &wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionLabelNameConditionArgs{
									LabelName: pulumi.String("awswaf:111122223333:rulegroup:testRules:LabelNameZ"),
								},
							},
						},
						Behavior:    pulumi.String("DROP"),
						Requirement: pulumi.String("MEETS_ALL"),
					},
					&wafv2.WebAclLoggingConfigurationLoggingFilterFilterArgs{
						Conditions: wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionArray{
							&wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs{
								ActionCondition: &wafv2.WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs{
									Action: pulumi.String("ALLOW"),
								},
							},
						},
						Behavior:    pulumi.String("KEEP"),
						Requirement: pulumi.String("MEETS_ANY"),
					},
				},
				DefaultBehavior: pulumi.String("KEEP"),
			},
			LogDestinationConfigs: pulumi.StringArray{
				exampleAwsKinesisFirehoseDeliveryStream.Arn,
			},
			ResourceArn: pulumi.Any(exampleAwsWafv2WebAcl.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_wafv2_webaclloggingconfiguration" "example" {
  logging_filter = {
    filters = [{
      "conditions" = [{
        "actionCondition" = {
          "action" = "COUNT"
        }
        }, {
        "labelNameCondition" = {
          "labelName" = "awswaf:111122223333:rulegroup:testRules:LabelNameZ"
        }
      }]
      "behavior"    = "DROP"
      "requirement" = "MEETS_ALL"
      }, {
      "conditions" = [{
        "actionCondition" = {
          "action" = "ALLOW"
        }
      }]
      "behavior"    = "KEEP"
      "requirement" = "MEETS_ANY"
    }]
    default_behavior = "KEEP"
  }
  log_destination_configs = [exampleAwsKinesisFirehoseDeliveryStream.arn]
  resource_arn            = exampleAwsWafv2WebAcl.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.wafv2.WebAclLoggingConfiguration;
import com.pulumi.aws.wafv2.WebAclLoggingConfigurationArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationLoggingFilterArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationLoggingFilterFilterArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs;
import com.pulumi.aws.wafv2.inputs.WebAclLoggingConfigurationLoggingFilterFilterConditionLabelNameConditionArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new WebAclLoggingConfiguration("example", WebAclLoggingConfigurationArgs.builder()
            .loggingFilter(WebAclLoggingConfigurationLoggingFilterArgs.builder()
                .filters(
                    WebAclLoggingConfigurationLoggingFilterFilterArgs.builder()
                        .conditions(
                            WebAclLoggingConfigurationLoggingFilterFilterConditionArgs.builder()
                                .actionCondition(WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs.builder()
                                    .action("COUNT")
                                    .build())
                                .build(),
                            WebAclLoggingConfigurationLoggingFilterFilterConditionArgs.builder()
                                .labelNameCondition(WebAclLoggingConfigurationLoggingFilterFilterConditionLabelNameConditionArgs.builder()
                                    .labelName("awswaf:111122223333:rulegroup:testRules:LabelNameZ")
                                    .build())
                                .build())
                        .behavior("DROP")
                        .requirement("MEETS_ALL")
                        .build(),
                    WebAclLoggingConfigurationLoggingFilterFilterArgs.builder()
                        .conditions(WebAclLoggingConfigurationLoggingFilterFilterConditionArgs.builder()
                            .actionCondition(WebAclLoggingConfigurationLoggingFilterFilterConditionActionConditionArgs.builder()
                                .action("ALLOW")
                                .build())
                            .build())
                        .behavior("KEEP")
                        .requirement("MEETS_ANY")
                        .build())
                .defaultBehavior("KEEP")
                .build())
            .logDestinationConfigs(exampleAwsKinesisFirehoseDeliveryStream.arn())
            .resourceArn(exampleAwsWafv2WebAcl.arn())
            .build());

    }
}
resources:
  example:
    type: aws:wafv2:WebAclLoggingConfiguration
    properties:
      loggingFilter:
        filters:
          - conditions:
              - actionCondition:
                  action: COUNT
              - labelNameCondition:
                  labelName: awswaf:111122223333:rulegroup:testRules:LabelNameZ
            behavior: DROP
            requirement: MEETS_ALL
          - conditions:
              - actionCondition:
                  action: ALLOW
            behavior: KEEP
            requirement: MEETS_ANY
        defaultBehavior: KEEP
      logDestinationConfigs:
        - ${exampleAwsKinesisFirehoseDeliveryStream.arn}
      resourceArn: ${exampleAwsWafv2WebAcl.arn}

Import

Using pulumi import, import WAFv2 Web ACL Logging Configurations using the ARN of the WAFv2 Web ACL. For example:

$ pulumi import aws:wafv2/webAclLoggingConfiguration:WebAclLoggingConfiguration example arn:aws:wafv2:us-west-2:123456789012:regional/webacl/test-logs/a1b2c3d4-5678-90ab-cdef

Constructors

WebAclLoggingConfiguration(String name, {WebAclLoggingConfigurationArgs? args, CustomResourceOptions? options})
Creates a new WebAclLoggingConfiguration. name The Pulumi resource name. args Arguments used to configure this WebAclLoggingConfiguration. The set of arguments for WebAclLoggingConfiguration. options Resource options controlling this resource's behavior.
WebAclLoggingConfiguration.reference(String urn)
Creates a typed reference to an existing WebAclLoggingConfiguration resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
logDestinationConfigs ↔ Output<List<String>>
Configuration block that allows you to associate Amazon Kinesis Data Firehose, Cloudwatch Log log group, or S3 bucket ARNs with the web ACL. Note: data firehose, log group, or bucket name must be prefixed with aws-waf-logs-, e.g. aws-waf-logs-example-firehose, aws-waf-logs-example-log-group, or aws-waf-logs-example-bucket.
latefinal
loggingFilter ↔ Output<WebAclLoggingConfigurationLoggingFilter?>
Configuration block that specifies which web requests are kept in the logs and which are dropped. It allows filtering based on the rule action and the web request labels applied by matching rules during web ACL evaluation. For more details, refer to the Logging Filter section below.
latefinal
redactedFields ↔ Output<List<WebAclLoggingConfigurationRedactedField>?>
Configuration for parts of the request that you want to keep out of the logs. Up to 100 redactedFields blocks are supported. See Redacted Fields below for more details.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceArn ↔ Output<String>
ARN of the web ACL that you want to associate with logDestinationConfigs.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {WebAclLoggingConfigurationState? state, CustomResourceOptions? options}) → WebAclLoggingConfiguration
Gets an existing WebAclLoggingConfiguration resource's state with the given name and id.