LogMetricFilter

Provides a CloudWatch Log Metric Filter resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var dada = new Aws.CloudWatch.LogGroup("dada", new Aws.CloudWatch.LogGroupArgs
        {
        });
        var yada = new Aws.CloudWatch.LogMetricFilter("yada", new Aws.CloudWatch.LogMetricFilterArgs
        {
            LogGroupName = dada.Name,
            MetricTransformation = new Aws.CloudWatch.Inputs.LogMetricFilterMetricTransformationArgs
            {
                Name = "EventCount",
                Namespace = "YourNamespace",
                Value = "1",
            },
            Pattern = "",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/cloudwatch"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        dada, err := cloudwatch.NewLogGroup(ctx, "dada", nil)
        if err != nil {
            return err
        }
        _, err = cloudwatch.NewLogMetricFilter(ctx, "yada", &cloudwatch.LogMetricFilterArgs{
            LogGroupName: dada.Name,
            MetricTransformation: &cloudwatch.LogMetricFilterMetricTransformationArgs{
                Name:      pulumi.String("EventCount"),
                Namespace: pulumi.String("YourNamespace"),
                Value:     pulumi.String("1"),
            },
            Pattern: pulumi.String(""),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

dada = aws.cloudwatch.LogGroup("dada")
yada = aws.cloudwatch.LogMetricFilter("yada",
    log_group_name=dada.name,
    metric_transformation={
        "name": "EventCount",
        "namespace": "YourNamespace",
        "value": "1",
    },
    pattern="")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const dada = new aws.cloudwatch.LogGroup("dada", {});
const yada = new aws.cloudwatch.LogMetricFilter("yada", {
    logGroupName: dada.name,
    metricTransformation: {
        name: "EventCount",
        namespace: "YourNamespace",
        value: "1",
    },
    pattern: "",
});

Create a LogMetricFilter Resource

def LogMetricFilter(resource_name, opts=None, log_group_name=None, metric_transformation=None, name=None, pattern=None, __props__=None);
name string
The unique name of the resource.
args LogMetricFilterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args LogMetricFilterArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args LogMetricFilterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

LogMetricFilter Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The LogMetricFilter resource accepts the following input properties:

LogGroupName string

The name of the log group to associate the metric filter with.

MetricTransformation LogMetricFilterMetricTransformationArgs

A block defining collection of information needed to define how metric data gets emitted. See below.

Pattern string

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

Name string

A name for the metric filter.

LogGroupName string

The name of the log group to associate the metric filter with.

MetricTransformation LogMetricFilterMetricTransformation

A block defining collection of information needed to define how metric data gets emitted. See below.

Pattern string

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

Name string

A name for the metric filter.

logGroupName string

The name of the log group to associate the metric filter with.

metricTransformation LogMetricFilterMetricTransformation

A block defining collection of information needed to define how metric data gets emitted. See below.

pattern string

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

name string

A name for the metric filter.

log_group_name str

The name of the log group to associate the metric filter with.

metric_transformation Dict[LogMetricFilterMetricTransformation]

A block defining collection of information needed to define how metric data gets emitted. See below.

pattern str

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

name str

A name for the metric filter.

Outputs

All input properties are implicitly available as output properties. Additionally, the LogMetricFilter resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing LogMetricFilter Resource

Get an existing LogMetricFilter resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LogMetricFilterState, opts?: CustomResourceOptions): LogMetricFilter
static get(resource_name, id, opts=None, log_group_name=None, metric_transformation=None, name=None, pattern=None, __props__=None);
func GetLogMetricFilter(ctx *Context, name string, id IDInput, state *LogMetricFilterState, opts ...ResourceOption) (*LogMetricFilter, error)
public static LogMetricFilter Get(string name, Input<string> id, LogMetricFilterState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

LogGroupName string

The name of the log group to associate the metric filter with.

MetricTransformation LogMetricFilterMetricTransformationArgs

A block defining collection of information needed to define how metric data gets emitted. See below.

Name string

A name for the metric filter.

Pattern string

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

LogGroupName string

The name of the log group to associate the metric filter with.

MetricTransformation LogMetricFilterMetricTransformation

A block defining collection of information needed to define how metric data gets emitted. See below.

Name string

A name for the metric filter.

Pattern string

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

logGroupName string

The name of the log group to associate the metric filter with.

metricTransformation LogMetricFilterMetricTransformation

A block defining collection of information needed to define how metric data gets emitted. See below.

name string

A name for the metric filter.

pattern string

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

log_group_name str

The name of the log group to associate the metric filter with.

metric_transformation Dict[LogMetricFilterMetricTransformation]

A block defining collection of information needed to define how metric data gets emitted. See below.

name str

A name for the metric filter.

pattern str

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

Supporting Types

LogMetricFilterMetricTransformation

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string

The name of the CloudWatch metric to which the monitored log information should be published (e.g. ErrorCount)

Namespace string

The destination namespace of the CloudWatch metric.

Value string

What to publish to the metric. For example, if you’re counting the occurrences of a particular term like “Error”, the value will be “1” for each occurrence. If you’re counting the bytes transferred the published value will be the value in the log event.

DefaultValue string

The value to emit when a filter pattern does not match a log event.

Name string

The name of the CloudWatch metric to which the monitored log information should be published (e.g. ErrorCount)

Namespace string

The destination namespace of the CloudWatch metric.

Value string

What to publish to the metric. For example, if you’re counting the occurrences of a particular term like “Error”, the value will be “1” for each occurrence. If you’re counting the bytes transferred the published value will be the value in the log event.

DefaultValue string

The value to emit when a filter pattern does not match a log event.

name string

The name of the CloudWatch metric to which the monitored log information should be published (e.g. ErrorCount)

namespace string

The destination namespace of the CloudWatch metric.

value string

What to publish to the metric. For example, if you’re counting the occurrences of a particular term like “Error”, the value will be “1” for each occurrence. If you’re counting the bytes transferred the published value will be the value in the log event.

defaultValue string

The value to emit when a filter pattern does not match a log event.

name str

The name of the CloudWatch metric to which the monitored log information should be published (e.g. ErrorCount)

namespace str

The destination namespace of the CloudWatch metric.

value str

What to publish to the metric. For example, if you’re counting the occurrences of a particular term like “Error”, the value will be “1” for each occurrence. If you’re counting the bytes transferred the published value will be the value in the log event.

default_value str

The value to emit when a filter pattern does not match a log event.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.