AWS::Logs::MetricFilter MetricTransformation
MetricTransformation
is a property of the AWS::Logs::MetricFilter
resource that describes
how to transform log streams into a CloudWatch metric.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "DefaultValue" :
Number
, "Dimensions" :[ Dimension, ... ]
, "MetricName" :String
, "MetricNamespace" :String
, "MetricValue" :String
, "Unit" :String
}
YAML
DefaultValue:
Number
Dimensions:- Dimension
MetricName:String
MetricNamespace:String
MetricValue:String
Unit:String
Properties
DefaultValue
-
(Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
Required: No
Type: Number
Update requires: No interruption
Dimensions
-
The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Important
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.
Required: No
Type: Array of Dimension
Minimum:
1
Maximum:
3
Update requires: No interruption
MetricName
-
The name of the CloudWatch metric.
Required: Yes
Type: String
Pattern:
^((?![:*$])[\x00-\x7F]){1,255}
Minimum:
1
Maximum:
255
Update requires: No interruption
MetricNamespace
-
A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
Required: Yes
Type: String
Pattern:
^[0-9a-zA-Z\.\-_\/#]{1,256}
Minimum:
1
Maximum:
256
Update requires: No interruption
MetricValue
-
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
.Required: Yes
Type: String
Pattern:
.{1,100}
Minimum:
1
Maximum:
100
Update requires: No interruption
Unit
-
The unit to assign to the metric. If you omit this, the unit is set as
None
.Required: No
Type: String
Allowed values:
Seconds | Microseconds | Milliseconds | Bytes | Kilobytes | Megabytes | Gigabytes | Terabytes | Bits | Kilobits | Megabits | Gigabits | Terabits | Percent | Count | Bytes/Second | Kilobytes/Second | Megabytes/Second | Gigabytes/Second | Terabytes/Second | Bits/Second | Kilobits/Second | Megabits/Second | Gigabits/Second | Terabits/Second | Count/Second | None
Update requires: No interruption