LogSubscriptionFilter class

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/v7/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
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_cloudwatch_logsubscriptionfilter" "test_lambdafunction_logfilter" {
  name            = "test_lambdafunction_logfilter"
  role_arn        = iamForLambda.arn
  log_group       = "/aws/lambda/example_lambda_name"
  filter_pattern  = "logtype test"
  destination_arn = testLogstream.arn
  distribution    = "Random"
}
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.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 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

Identity Schema

Required

  • logGroupName (String) Name of the log group.
  • name (String) Name of the subscription filter.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import Subscription Filters using logGroupName and name separated by a vertical bar (|). For example:

$ pulumi import aws:cloudwatch/logSubscriptionFilter:LogSubscriptionFilter example example-group|example-filter

Constructors

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

Properties

applyOnTransformedLogs ↔ Output<bool>
Boolean to indicate whether to apply the subscription filter on the transformed version of the log events instead of the original ingested log events. Defaults to false. Valid only for log groups that have an active log transformer.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
destinationArn ↔ Output<String>
ARN of the destination to deliver matching log events to. Kinesis stream or Lambda function ARN.
latefinal
distribution ↔ Output<String?>
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".
latefinal
emitSystemFields ↔ Output<List<String>?>
List of system fields to include in the log events sent to the subscription destination. These fields provide source information for centralized log data in the forwarded payload. Valid values: "@aws.account", "@aws.region", "@source.log". To remove this argument after it has been set, specify an empty list [] explicitly to avoid perpetual differences.
latefinal
filterPattern ↔ Output<String>
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.
latefinal
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
logGroup ↔ Output<String>
Name of the log group to associate the subscription filter with.
latefinal
name ↔ Output<String>
Name for the subscription filter.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
roleArn ↔ Output<String>
ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery. 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.
latefinal
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, {LogSubscriptionFilterState? state, CustomResourceOptions? options}) LogSubscriptionFilter
Gets an existing LogSubscriptionFilter resource's state with the given name and id.