Class CfnMetricFilter.MetricTransformationProperty
MetricTransformation
is a property of the AWS::Logs::MetricFilter
resource that describes how to transform log streams into a CloudWatch metric.
Inheritance
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.AWS.Logs.dll
Syntax (csharp)
public class MetricTransformationProperty : Object, CfnMetricFilter.IMetricTransformationProperty
Syntax (vb)
Public Class MetricTransformationProperty
Inherits Object
Implements CfnMetricFilter.IMetricTransformationProperty
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Logs;
var metricTransformationProperty = new MetricTransformationProperty {
MetricName = "metricName",
MetricNamespace = "metricNamespace",
MetricValue = "metricValue",
// the properties below are optional
DefaultValue = 123,
Dimensions = new [] { new DimensionProperty {
Key = "key",
Value = "value"
} },
Unit = "unit"
};
Synopsis
Constructors
MetricTransformationProperty() |
Properties
DefaultValue | (Optional) The value to emit when a filter pattern does not match a log event. |
Dimensions | The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions. |
MetricName | The name of the CloudWatch metric. |
MetricNamespace | A custom namespace to contain your metric in CloudWatch. |
MetricValue | The value that is published to the CloudWatch metric. |
Unit | The unit to assign to the metric. |
Constructors
MetricTransformationProperty()
public MetricTransformationProperty()
Properties
DefaultValue
(Optional) The value to emit when a filter pattern does not match a log event.
public Nullable<double> DefaultValue { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Dimensions
The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
public object Dimensions { get; set; }
Property Value
System.Object
Remarks
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress
or requestID
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 .
MetricName
The name of the CloudWatch metric.
public string MetricName { get; set; }
Property Value
System.String
Remarks
MetricNamespace
A custom namespace to contain your metric in CloudWatch.
public string MetricNamespace { get; set; }
Property Value
System.String
Remarks
Use namespaces to group together metrics that are similar. For more information, see Namespaces .
MetricValue
The value that is published to the CloudWatch metric.
public string MetricValue { get; set; }
Property Value
System.String
Remarks
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
.
Unit
The unit to assign to the metric.
public string Unit { get; set; }
Property Value
System.String
Remarks
If you omit this, the unit is set as None
.