Interface CfnMetricFilter.MetricTransformationProperty
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CfnMetricFilter.MetricTransformationProperty.Jsii$Proxy
- Enclosing class:
CfnMetricFilter
MetricTransformation
is a property of the AWS::Logs::MetricFilter
resource that describes how to transform log streams into a CloudWatch metric.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.logs.*; MetricTransformationProperty metricTransformationProperty = MetricTransformationProperty.builder() .metricName("metricName") .metricNamespace("metricNamespace") .metricValue("metricValue") // the properties below are optional .defaultValue(123) .dimensions(List.of(DimensionProperty.builder() .key("key") .value("value") .build())) .unit("unit") .build();
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forCfnMetricFilter.MetricTransformationProperty
static final class
An implementation forCfnMetricFilter.MetricTransformationProperty
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
default Number
(Optional) The value to emit when a filter pattern does not match a log event.default Object
The fields to use as dimensions for the metric.The name of the CloudWatch metric.A custom namespace to contain your metric in CloudWatch.The value that is published to the CloudWatch metric.default String
getUnit()
The unit to assign to the metric.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getMetricName
The name of the CloudWatch metric.- See Also:
-
getMetricNamespace
A custom namespace to contain your metric in CloudWatch.Use namespaces to group together metrics that are similar. For more information, see Namespaces .
- See Also:
-
getMetricValue
The value that is published to the CloudWatch metric.For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
.- See Also:
-
getDefaultValue
(Optional) The value to emit when a filter pattern does not match a log event.This value can be null.
- See Also:
-
getDimensions
The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.CloudWatch Logs disables a metric filter if it generates 1000 different name/value pairs for your specified dimensions within a certain amount of time. This helps to prevent accidental high charges.
You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated AWS Charges .
- See Also:
-
getUnit
The unit to assign to the metric.If you omit this, the unit is set as
None
.- See Also:
-
builder
-