Class: AWSCDK::Logs::MetricFilterProps
- Inherits:
-
MetricFilterOptions
- Object
- MetricFilterOptions
- AWSCDK::Logs::MetricFilterProps
- Defined in:
- logs/metric_filter_props.rb
Overview
Properties for a MetricFilter.
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.
-
#log_group ⇒ AWSCDK::Interfaces::AWSLogs::ILogGroupRef
readonly
The log group to create the filter on.
-
#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, log_group:) ⇒ MetricFilterProps
constructor
A new instance of MetricFilterProps.
- #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, log_group:) ⇒ MetricFilterProps
Returns a new instance of MetricFilterProps.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'logs/metric_filter_props.rb', line 17 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, log_group:) @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? @log_group = log_group Jsii::Type.check_type(@log_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19sb2dzLklMb2dHcm91cFJlZiJ9")), "logGroup") 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.
59 60 61 |
# File 'logs/metric_filter_props.rb', line 59 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.
64 65 66 |
# File 'logs/metric_filter_props.rb', line 64 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.
72 73 74 |
# File 'logs/metric_filter_props.rb', line 72 def dimensions @dimensions end |
#filter_name ⇒ String? (readonly)
Default: - Cloudformation generated name.
The name of the metric filter.
77 78 79 |
# File 'logs/metric_filter_props.rb', line 77 def filter_name @filter_name end |
#filter_pattern ⇒ AWSCDK::Logs::IFilterPattern (readonly)
Pattern to search for log events.
43 44 45 |
# File 'logs/metric_filter_props.rb', line 43 def filter_pattern @filter_pattern end |
#log_group ⇒ AWSCDK::Interfaces::AWSLogs::ILogGroupRef (readonly)
The log group to create the filter on.
102 103 104 |
# File 'logs/metric_filter_props.rb', line 102 def log_group @log_group end |
#metric_name ⇒ String (readonly)
The name of the metric to emit.
47 48 49 |
# File 'logs/metric_filter_props.rb', line 47 def metric_name @metric_name end |
#metric_namespace ⇒ String (readonly)
The namespace of the metric to emit.
51 52 53 |
# File 'logs/metric_filter_props.rb', line 51 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'.
92 93 94 |
# File 'logs/metric_filter_props.rb', line 92 def metric_value @metric_value end |
#unit ⇒ AWSCDK::CloudWatch::Unit? (readonly)
Default: - No unit attached to metrics.
The unit to assign to the metric.
98 99 100 |
# File 'logs/metric_filter_props.rb', line 98 def unit @unit end |
Class Method Details
.jsii_properties ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'logs/metric_filter_props.rb', line 104 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", :log_group => "logGroup", } end |
Instance Method Details
#to_jsii ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'logs/metric_filter_props.rb', line 119 def to_jsii result = {} result.merge!(super) 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, "logGroup" => @log_group, }) result.compact end |