Resource: awsCloudwatchLogSubscriptionFilter
Provides a CloudWatch Logs subscription filter resource.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.cloudwatchLogSubscriptionFilter.CloudwatchLogSubscriptionFilter(
this,
"test_lambdafunction_logfilter",
{
destinationArn: "${aws_kinesis_stream.test_logstream.arn}",
distribution: "Random",
filterPattern: "logtype test",
logGroupName: "/aws/lambda/example_lambda_name",
name: "test_lambdafunction_logfilter",
roleArn: "${aws_iam_role.iam_for_lambda.arn}",
}
);
Argument Reference
The following arguments are supported:
name
- (Required) A name for the subscription filterdestinationArn
- (Required) The ARN of the destination to deliver matching log events to. Kinesis stream or Lambda function ARN.filterPattern
- (Required) A valid CloudWatch Logs filter pattern for subscribing to a filtered stream of log events. Use empty string""
to match everything. For more information, see the Amazon CloudWatch Logs User Guide.logGroupName
- (Required) The name of the log group to associate the subscription filter withroleArn
- (Optional) The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to deliver ingested log events to the destination. If you use Lambda as a destination, you should skip this argument and useawsLambdaPermission
resource for granting access from CloudWatch logs to the destination Lambda function.distribution
- (Optional) The method used to distribute log data to the destination. By default log data is grouped by log stream, but the grouping can be set to random for a more even distribution. This property is only applicable when the destination is an Amazon Kinesis stream. Valid values are "Random" and "ByLogStream".
Attributes Reference
No additional attributes are exported.
Import
CloudWatch Logs subscription filter can be imported using the log group name and subscription filter name separated by |
.