Class: AWSCDK::Logs::FilterPattern

Inherits:
Jsii::Object
  • Object
show all
Defined in:
logs/filter_pattern.rb

Overview

A collection of static methods to generate appropriate ILogPatterns.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFilterPattern

Returns a new instance of FilterPattern.



8
9
10
# File 'logs/filter_pattern.rb', line 8

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.all(*patterns) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that matches if all given JSON log patterns match.

Parameters:

Returns:



21
22
23
24
25
26
# File 'logs/filter_pattern.rb', line 21

def self.all(*patterns)
  patterns.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5Kc29uUGF0dGVybiJ9")), "patterns[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "all", [*patterns])
end

.all_eventsAWSCDK::Logs::IFilterPattern

A log pattern that matches all events.



31
32
33
# File 'logs/filter_pattern.rb', line 31

def self.all_events()
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "allEvents", [])
end

.all_terms(*terms) ⇒ AWSCDK::Logs::IFilterPattern

A log pattern that matches if all the strings given appear in the event.

Parameters:

  • terms (Array<String>)

    The words to search for.

Returns:



39
40
41
42
43
44
# File 'logs/filter_pattern.rb', line 39

def self.all_terms(*terms)
  terms.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "terms[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "allTerms", [*terms])
end

.any(*patterns) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that matches if any of the given JSON log patterns match.

Parameters:

Returns:



50
51
52
53
54
55
# File 'logs/filter_pattern.rb', line 50

def self.any(*patterns)
  patterns.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5Kc29uUGF0dGVybiJ9")), "patterns[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "any", [*patterns])
end

.any_term(*terms) ⇒ AWSCDK::Logs::IFilterPattern

A log pattern that matches if any of the strings given appear in the event.

Parameters:

  • terms (Array<String>)

    The words to search for.

Returns:



61
62
63
64
65
66
# File 'logs/filter_pattern.rb', line 61

def self.any_term(*terms)
  terms.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "terms[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "anyTerm", [*terms])
end

.any_term_group(*term_groups) ⇒ AWSCDK::Logs::IFilterPattern

A log pattern that matches if any of the given term groups matches the event.

A term group matches an event if all the terms in it appear in the event string.

Parameters:

  • term_groups (Array<Array<String>>)

    A list of term groups to search for.

Returns:



74
75
76
77
78
79
# File 'logs/filter_pattern.rb', line 74

def self.any_term_group(*term_groups)
  term_groups.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "termGroups[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "anyTermGroup", [*term_groups])
end

.boolean_value(json_field, value) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that matches if the field exists and equals the boolean value.

Parameters:

  • json_field (String)

    Field inside JSON.

  • value (Boolean)

    The value to match.

Returns:



86
87
88
89
90
# File 'logs/filter_pattern.rb', line 86

def self.boolean_value(json_field, value)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "value")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "booleanValue", [json_field, value])
end

.exists(json_field) ⇒ AWSCDK::Logs::JsonPattern

A JSON log patter that matches if the field exists.

This is a readable convenience wrapper over 'field = *'

Parameters:

  • json_field (String)

    Field inside JSON.

Returns:



98
99
100
101
# File 'logs/filter_pattern.rb', line 98

def self.exists(json_field)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "exists", [json_field])
end

.is_null(json_field) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that matches if the field exists and has the special value 'null'.

Parameters:

  • json_field (String)

    Field inside JSON.

Returns:



107
108
109
110
# File 'logs/filter_pattern.rb', line 107

def self.is_null(json_field)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "isNull", [json_field])
end

.jsii_overridable_methodsObject



12
13
14
15
# File 'logs/filter_pattern.rb', line 12

def self.jsii_overridable_methods
  {
  }
end

.literal(log_pattern_string) ⇒ AWSCDK::Logs::IFilterPattern

Use the given string as log pattern.

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html for information on writing log patterns.

Parameters:

  • log_pattern_string (String)

    The pattern string to use.

Returns:



119
120
121
122
# File 'logs/filter_pattern.rb', line 119

def self.literal(log_pattern_string)
  Jsii::Type.check_type(log_pattern_string, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "logPatternString")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "literal", [log_pattern_string])
end

.not_exists(json_field) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that matches if the field does not exist.

Parameters:

  • json_field (String)

    Field inside JSON.

Returns:



128
129
130
131
# File 'logs/filter_pattern.rb', line 128

def self.not_exists(json_field)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "notExists", [json_field])
end

.number_value(json_field, comparison, value) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that compares numerical values.

This pattern only matches if the event is a JSON event, and the indicated field inside compares with the value in the indicated way.

Use '$' to indicate the root of the JSON structure. The comparison operator can only compare equality or inequality. The '*' wildcard may appear in the value may at the start or at the end.

For more information, see:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html

Parameters:

  • json_field (String)

    Field inside JSON.

  • comparison (String)

    Comparison to carry out.

  • value (Numeric)

    The numerical value to compare to.

Returns:



150
151
152
153
154
155
# File 'logs/filter_pattern.rb', line 150

def self.number_value(json_field, comparison, value)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Type.check_type(comparison, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comparison")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "value")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "numberValue", [json_field, comparison, value])
end

.regex_value(json_field, comparison, value) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that compares against a Regex values.

This pattern only matches if the event is a JSON event, and the indicated field inside compares with the regex value.

Use '$' to indicate the root of the JSON structure. The comparison operator can only compare equality or inequality.

For more information, see:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html

Parameters:

  • json_field (String)

    Field inside JSON.

  • comparison (String)

    Comparison to carry out.

  • value (String)

    The regex value to compare to.

Returns:



173
174
175
176
177
178
# File 'logs/filter_pattern.rb', line 173

def self.regex_value(json_field, comparison, value)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Type.check_type(comparison, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comparison")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "value")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "regexValue", [json_field, comparison, value])
end

.space_delimited(*columns) ⇒ AWSCDK::Logs::SpaceDelimitedTextPattern

A space delimited log pattern matcher.

The log event is divided into space-delimited columns (optionally enclosed by "" or [] to capture spaces into column values), and names are given to each column.

'...' may be specified once to match any number of columns.

Afterwards, conditions may be added to individual columns.

Parameters:

  • columns (Array<String>)

    The columns in the space-delimited log stream.

Returns:



192
193
194
195
196
197
# File 'logs/filter_pattern.rb', line 192

def self.space_delimited(*columns)
  columns.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "columns[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "spaceDelimited", [*columns])
end

.string_value(json_field, comparison, value) ⇒ AWSCDK::Logs::JsonPattern

A JSON log pattern that compares string values.

This pattern only matches if the event is a JSON event, and the indicated field inside compares with the string value.

Use '$' to indicate the root of the JSON structure. The comparison operator can only compare equality or inequality. The '*' wildcard may appear in the value may at the start or at the end.

For more information, see:

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html

Parameters:

  • json_field (String)

    Field inside JSON.

  • comparison (String)

    Comparison to carry out.

  • value (String)

    The string value to compare to.

Returns:



216
217
218
219
220
221
# File 'logs/filter_pattern.rb', line 216

def self.string_value(json_field, comparison, value)
  Jsii::Type.check_type(json_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "jsonField")
  Jsii::Type.check_type(comparison, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comparison")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "value")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_logs.FilterPattern", "stringValue", [json_field, comparison, value])
end