LogSubscriptionFilterArgs

data class LogSubscriptionFilterArgs(val destinationArn: Output<String>? = null, val distribution: Output<String>? = null, val filterPattern: Output<String>? = null, val logGroup: Output<String>? = null, val name: Output<String>? = null, val roleArn: Output<String>? = null) : ConvertibleToJava<LogSubscriptionFilterArgs>

Provides a CloudWatch Logs subscription filter resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const testLambdafunctionLogfilter = new aws.cloudwatch.LogSubscriptionFilter("test_lambdafunction_logfilter", {
name: "test_lambdafunction_logfilter",
roleArn: iamForLambda.arn,
logGroup: "/aws/lambda/example_lambda_name",
filterPattern: "logtype test",
destinationArn: testLogstream.arn,
distribution: "Random",
});
import pulumi
import pulumi_aws as aws
test_lambdafunction_logfilter = aws.cloudwatch.LogSubscriptionFilter("test_lambdafunction_logfilter",
name="test_lambdafunction_logfilter",
role_arn=iam_for_lambda["arn"],
log_group="/aws/lambda/example_lambda_name",
filter_pattern="logtype test",
destination_arn=test_logstream["arn"],
distribution="Random")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var testLambdafunctionLogfilter = new Aws.CloudWatch.LogSubscriptionFilter("test_lambdafunction_logfilter", new()
{
Name = "test_lambdafunction_logfilter",
RoleArn = iamForLambda.Arn,
LogGroup = "/aws/lambda/example_lambda_name",
FilterPattern = "logtype test",
DestinationArn = testLogstream.Arn,
Distribution = "Random",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudwatch.NewLogSubscriptionFilter(ctx, "test_lambdafunction_logfilter", &cloudwatch.LogSubscriptionFilterArgs{
Name: pulumi.String("test_lambdafunction_logfilter"),
RoleArn: pulumi.Any(iamForLambda.Arn),
LogGroup: pulumi.Any("/aws/lambda/example_lambda_name"),
FilterPattern: pulumi.String("logtype test"),
DestinationArn: pulumi.Any(testLogstream.Arn),
Distribution: pulumi.String("Random"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.LogSubscriptionFilter;
import com.pulumi.aws.cloudwatch.LogSubscriptionFilterArgs;
import java.util.List;
import java.util.ArrayList;
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 testLambdafunctionLogfilter = new LogSubscriptionFilter("testLambdafunctionLogfilter", LogSubscriptionFilterArgs.builder()
.name("test_lambdafunction_logfilter")
.roleArn(iamForLambda.arn())
.logGroup("/aws/lambda/example_lambda_name")
.filterPattern("logtype test")
.destinationArn(testLogstream.arn())
.distribution("Random")
.build());
}
}
resources:
testLambdafunctionLogfilter:
type: aws:cloudwatch:LogSubscriptionFilter
name: test_lambdafunction_logfilter
properties:
name: test_lambdafunction_logfilter
roleArn: ${iamForLambda.arn}
logGroup: /aws/lambda/example_lambda_name
filterPattern: logtype test
destinationArn: ${testLogstream.arn}
distribution: Random

Import

Using pulumi import, import CloudWatch Logs subscription filter using the log group name and subscription filter name separated by |. For example:

$ pulumi import aws:cloudwatch/logSubscriptionFilter:LogSubscriptionFilter test_lambdafunction_logfilter "/aws/lambda/example_lambda_name|test_lambdafunction_logfilter"

Constructors

Link copied to clipboard
constructor(destinationArn: Output<String>? = null, distribution: Output<String>? = null, filterPattern: Output<String>? = null, logGroup: Output<String>? = null, name: Output<String>? = null, roleArn: Output<String>? = null)

Properties

Link copied to clipboard
val destinationArn: Output<String>? = null

The ARN of the destination to deliver matching log events to. Kinesis stream or Lambda function ARN.

Link copied to clipboard
val distribution: Output<String>? = null

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".

Link copied to clipboard
val filterPattern: Output<String>? = null

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.

Link copied to clipboard
val logGroup: Output<String>? = null

The name of the log group to associate the subscription filter with

Link copied to clipboard
val name: Output<String>? = null

A name for the subscription filter

Link copied to clipboard
val roleArn: Output<String>? = null

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 use aws.lambda.Permission resource for granting access from CloudWatch logs to the destination Lambda function.

Functions

Link copied to clipboard
open override fun toJava(): LogSubscriptionFilterArgs