interface MetricTransformationProperty
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Logs.CfnMetricFilter.MetricTransformationProperty |
Java | software.amazon.awscdk.services.logs.CfnMetricFilter.MetricTransformationProperty |
Python | aws_cdk.aws_logs.CfnMetricFilter.MetricTransformationProperty |
TypeScript | @aws-cdk/aws-logs » CfnMetricFilter » MetricTransformationProperty |
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 * as logs from '@aws-cdk/aws-logs';
const metricTransformationProperty: logs.CfnMetricFilter.MetricTransformationProperty = {
metricName: 'metricName',
metricNamespace: 'metricNamespace',
metricValue: 'metricValue',
// the properties below are optional
defaultValue: 123,
dimensions: [{
key: 'key',
value: 'value',
}],
unit: 'unit',
};
Properties
Name | Type | Description |
---|---|---|
metric | string | The name of the CloudWatch metric. |
metric | string | A custom namespace to contain your metric in CloudWatch. |
metric | string | The value that is published to the CloudWatch metric. |
default | number | (Optional) The value to emit when a filter pattern does not match a log event. |
dimensions? | IResolvable | IResolvable | Dimension [] | The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions. |
unit? | string | The unit to assign to the metric. |
metricName
Type:
string
The name of the CloudWatch metric.
metricNamespace
Type:
string
A custom namespace to contain your metric in CloudWatch.
Use namespaces to group together metrics that are similar. For more information, see Namespaces .
metricValue
Type:
string
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
.
defaultValue?
Type:
number
(optional)
(Optional) The value to emit when a filter pattern does not match a log event.
This value can be null.
dimensions?
Type:
IResolvable
|
IResolvable
|
Dimension
[]
(optional)
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 .
unit?
Type:
string
(optional)
The unit to assign to the metric.
If you omit this, the unit is set as None
.