Package com.pulumi.aws.cloudwatch
Class LogMetricFilter
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.cloudwatch.LogMetricFilter
-
public class LogMetricFilter extends com.pulumi.resources.CustomResourceProvides a CloudWatch Log Metric Filter resource. ## Example Usage
## Import ### Identity Schema #### Required * `logGroupName` (String) Name of the log group. * `name` (String) Name of the metric filter. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import Metric Filters using `logGroupName` and `name` separated by a colon (`:`). For example: ```sh $ pulumi import aws:cloudwatch/logMetricFilter:LogMetricFilter example example-group:example-filter ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.cloudwatch.LogGroup; import com.pulumi.aws.cloudwatch.LogGroupArgs; import com.pulumi.aws.cloudwatch.LogMetricFilter; import com.pulumi.aws.cloudwatch.LogMetricFilterArgs; import com.pulumi.aws.cloudwatch.inputs.LogMetricFilterMetricTransformationArgs; 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 dada = new LogGroup("dada", LogGroupArgs.builder() .name("MyApp/access.log") .build()); var yada = new LogMetricFilter("yada", LogMetricFilterArgs.builder() .metricTransformation(LogMetricFilterMetricTransformationArgs.builder() .name("EventCount") .namespace("YourNamespace") .value("1") .build()) .name("MyAppAccessCount") .pattern("") .logGroupName(dada.name()) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description LogMetricFilter(java.lang.String name)LogMetricFilter(java.lang.String name, LogMetricFilterArgs args)LogMetricFilter(java.lang.String name, LogMetricFilterArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.Boolean>applyOnTransformedLogs()static LogMetricFilterget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, LogMetricFilterState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>logGroupName()com.pulumi.core.Output<LogMetricFilterMetricTransformation>metricTransformation()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>pattern()com.pulumi.core.Output<java.lang.String>region()
-
-
-
Constructor Detail
-
LogMetricFilter
public LogMetricFilter(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
LogMetricFilter
public LogMetricFilter(java.lang.String name, LogMetricFilterArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
LogMetricFilter
public LogMetricFilter(java.lang.String name, LogMetricFilterArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
applyOnTransformedLogs
public com.pulumi.core.Output<java.lang.Boolean> applyOnTransformedLogs()
- Returns:
- Whether the metric filter will be applied 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.
-
logGroupName
public com.pulumi.core.Output<java.lang.String> logGroupName()
- Returns:
- The name of the log group to associate the metric filter with.
-
metricTransformation
public com.pulumi.core.Output<LogMetricFilterMetricTransformation> metricTransformation()
- Returns:
- A block defining collection of information needed to define how metric data gets emitted. See below.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- A name for the metric filter.
-
pattern
public com.pulumi.core.Output<java.lang.String> pattern()
- Returns:
- A valid [CloudWatch Logs filter pattern](https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/FilterAndPatternSyntax.html) for extracting metric data out of ingested log events.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
get
public static LogMetricFilter get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable LogMetricFilterState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-