Class: AWSCDK::Logs::MetricFilterOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Logs::MetricFilterOptions
- Defined in:
- logs/metric_filter_options.rb
Overview
Properties for a MetricFilter created from a LogGroup.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#apply_on_transformed_logs ⇒ Boolean?
readonly
Whether the metric filter is applied on the tranformed logs.
-
#default_value ⇒ Numeric?
readonly
The value to emit if the pattern does not match a particular event.
-
#dimensions ⇒ Hash{String => String}?
readonly
The fields to use as dimensions for the metric.
-
#filter_name ⇒ String?
readonly
The name of the metric filter.
-
#filter_pattern ⇒ AWSCDK::Logs::IFilterPattern
readonly
Pattern to search for log events.
-
#metric_name ⇒ String
readonly
The name of the metric to emit.
-
#metric_namespace ⇒ String
readonly
The namespace of the metric to emit.
-
#metric_value ⇒ String?
readonly
The value to emit for the metric.
-
#unit ⇒ AWSCDK::CloudWatch::Unit?
readonly
The unit to assign to the metric.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filter_pattern:, metric_name:, metric_namespace:, apply_on_transformed_logs: nil, default_value: nil, dimensions: nil, filter_name: nil, metric_value: nil, unit: nil) ⇒ MetricFilterOptions
constructor
A new instance of MetricFilterOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(filter_pattern:, metric_name:, metric_namespace:, apply_on_transformed_logs: nil, default_value: nil, dimensions: nil, filter_name: nil, metric_value: nil, unit: nil) ⇒ MetricFilterOptions
Returns a new instance of MetricFilterOptions.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'logs/metric_filter_options.rb', line 16 def initialize(filter_pattern:, metric_name:, metric_namespace:, apply_on_transformed_logs: nil, default_value: nil, dimensions: nil, filter_name: nil, metric_value: nil, unit: nil) @filter_pattern = filter_pattern Jsii::Type.check_type(@filter_pattern, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5JRmlsdGVyUGF0dGVybiJ9")), "filterPattern") @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") @apply_on_transformed_logs = apply_on_transformed_logs Jsii::Type.check_type(@apply_on_transformed_logs, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "applyOnTransformedLogs") unless @apply_on_transformed_logs.nil? @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("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "dimensions") unless @dimensions.nil? @filter_name = filter_name Jsii::Type.check_type(@filter_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "filterName") unless @filter_name.nil? @metric_value = metric_value Jsii::Type.check_type(@metric_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricValue") unless @metric_value.nil? @unit = unit Jsii::Type.check_type(@unit, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5Vbml0In0=")), "unit") unless @unit.nil? end |
Instance Attribute Details
#apply_on_transformed_logs ⇒ Boolean? (readonly)
Default: - false
Whether the metric filter is applied on the tranformed logs.
This parameter is valid only for log groups that have an active log transformer. If this value is true, the metric filter is applied on the transformed version of the log events instead of the original ingested log events.
56 57 58 |
# File 'logs/metric_filter_options.rb', line 56 def apply_on_transformed_logs @apply_on_transformed_logs end |
#default_value ⇒ Numeric? (readonly)
Default: No metric emitted.
The value to emit if the pattern does not match a particular event.
61 62 63 |
# File 'logs/metric_filter_options.rb', line 61 def default_value @default_value end |
#dimensions ⇒ Hash{String => String}? (readonly)
Default: - No dimensions attached to metrics.
The fields to use as dimensions for the metric.
One metric filter can include as many as three dimensions.
69 70 71 |
# File 'logs/metric_filter_options.rb', line 69 def dimensions @dimensions end |
#filter_name ⇒ String? (readonly)
Default: - Cloudformation generated name.
The name of the metric filter.
74 75 76 |
# File 'logs/metric_filter_options.rb', line 74 def filter_name @filter_name end |
#filter_pattern ⇒ AWSCDK::Logs::IFilterPattern (readonly)
Pattern to search for log events.
40 41 42 |
# File 'logs/metric_filter_options.rb', line 40 def filter_pattern @filter_pattern end |
#metric_name ⇒ String (readonly)
The name of the metric to emit.
44 45 46 |
# File 'logs/metric_filter_options.rb', line 44 def metric_name @metric_name end |
#metric_namespace ⇒ String (readonly)
The namespace of the metric to emit.
48 49 50 |
# File 'logs/metric_filter_options.rb', line 48 def metric_namespace @metric_namespace end |
#metric_value ⇒ String? (readonly)
Default: "1"
The value to emit for the metric.
Can either be a literal number (typically "1"), or the name of a field in the structure to take the value from the matched event. If you are using a field value, the field value must have been matched using the pattern.
If you want to specify a field from a matched JSON structure, use '$.fieldName', and make sure the field is in the pattern (if only as '$.fieldName = *').
If you want to specify a field from a matched space-delimited structure, use '$fieldName'.
89 90 91 |
# File 'logs/metric_filter_options.rb', line 89 def metric_value @metric_value end |
#unit ⇒ AWSCDK::CloudWatch::Unit? (readonly)
Default: - No unit attached to metrics.
The unit to assign to the metric.
95 96 97 |
# File 'logs/metric_filter_options.rb', line 95 def unit @unit end |
Class Method Details
.jsii_properties ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'logs/metric_filter_options.rb', line 97 def self.jsii_properties { :filter_pattern => "filterPattern", :metric_name => "metricName", :metric_namespace => "metricNamespace", :apply_on_transformed_logs => "applyOnTransformedLogs", :default_value => "defaultValue", :dimensions => "dimensions", :filter_name => "filterName", :metric_value => "metricValue", :unit => "unit", } end |
Instance Method Details
#to_jsii ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'logs/metric_filter_options.rb', line 111 def to_jsii result = {} result.merge!({ "filterPattern" => @filter_pattern, "metricName" => @metric_name, "metricNamespace" => @metric_namespace, "applyOnTransformedLogs" => @apply_on_transformed_logs, "defaultValue" => @default_value, "dimensions" => @dimensions, "filterName" => @filter_name, "metricValue" => @metric_value, "unit" => @unit, }) result.compact end |