Class: AWSCDK::Logs::CfnMetricFilter::MetricTransformationProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Logs::CfnMetricFilter::MetricTransformationProperty
- Defined in:
- logs/cfn_metric_filter.rb
Overview
MetricTransformation is a property of the AWS::Logs::MetricFilter resource that describes how to transform log streams into a CloudWatch metric.
Instance Attribute Summary collapse
-
#default_value ⇒ Numeric?
readonly
(Optional) The value to emit when a filter pattern does not match a log event.
-
#dimensions ⇒ AWSCDK::IResolvable, ...
readonly
The fields to use as dimensions for the metric.
-
#metric_name ⇒ String
readonly
The name of the CloudWatch metric.
-
#metric_namespace ⇒ String
readonly
A custom namespace to contain your metric in CloudWatch.
-
#metric_value ⇒ String
readonly
The value that is published to the CloudWatch metric.
-
#unit ⇒ String?
readonly
The unit to assign to the metric.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metric_name:, metric_namespace:, metric_value:, default_value: nil, dimensions: nil, unit: nil) ⇒ MetricTransformationProperty
constructor
A new instance of MetricTransformationProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(metric_name:, metric_namespace:, metric_value:, default_value: nil, dimensions: nil, unit: nil) ⇒ MetricTransformationProperty
Returns a new instance of MetricTransformationProperty.
636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
# File 'logs/cfn_metric_filter.rb', line 636 def initialize(metric_name:, metric_namespace:, metric_value:, default_value: nil, dimensions: nil, unit: nil) @metric_name = metric_name Jsii::Type.check_type(@metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") @metric_namespace = metric_namespace Jsii::Type.check_type(@metric_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricNamespace") @metric_value = metric_value Jsii::Type.check_type(@metric_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricValue") @default_value = default_value Jsii::Type.check_type(@default_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "defaultValue") unless @default_value.nil? @dimensions = dimensions Jsii::Type.check_type(@dimensions, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5DZm5NZXRyaWNGaWx0ZXIuRGltZW5zaW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "dimensions") unless @dimensions.nil? @unit = unit Jsii::Type.check_type(@unit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "unit") unless @unit.nil? end |
Instance Attribute Details
#default_value ⇒ Numeric? (readonly)
(Optional) The value to emit when a filter pattern does not match a log event.
This value can be null.
676 677 678 |
# File 'logs/cfn_metric_filter.rb', line 676 def default_value @default_value end |
#dimensions ⇒ AWSCDK::IResolvable, ... (readonly)
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
IPAddressorrequest_idas 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 .
687 688 689 |
# File 'logs/cfn_metric_filter.rb', line 687 def dimensions @dimensions end |
#metric_name ⇒ String (readonly)
The name of the CloudWatch metric.
655 656 657 |
# File 'logs/cfn_metric_filter.rb', line 655 def metric_name @metric_name end |
#metric_namespace ⇒ String (readonly)
A custom namespace to contain your metric in CloudWatch.
Use namespaces to group together metrics that are similar. For more information, see Namespaces .
662 663 664 |
# File 'logs/cfn_metric_filter.rb', line 662 def metric_namespace @metric_namespace end |
#metric_value ⇒ String (readonly)
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 .
669 670 671 |
# File 'logs/cfn_metric_filter.rb', line 669 def metric_value @metric_value end |
#unit ⇒ String? (readonly)
The unit to assign to the metric.
If you omit this, the unit is set as None .
694 695 696 |
# File 'logs/cfn_metric_filter.rb', line 694 def unit @unit end |
Class Method Details
.jsii_properties ⇒ Object
696 697 698 699 700 701 702 703 704 705 |
# File 'logs/cfn_metric_filter.rb', line 696 def self.jsii_properties { :metric_name => "metricName", :metric_namespace => "metricNamespace", :metric_value => "metricValue", :default_value => "defaultValue", :dimensions => "dimensions", :unit => "unit", } end |
Instance Method Details
#to_jsii ⇒ Object
707 708 709 710 711 712 713 714 715 716 717 718 |
# File 'logs/cfn_metric_filter.rb', line 707 def to_jsii result = {} result.merge!({ "metricName" => @metric_name, "metricNamespace" => @metric_namespace, "metricValue" => @metric_value, "defaultValue" => @default_value, "dimensions" => @dimensions, "unit" => @unit, }) result.compact end |