Class: AWSCDK::Logs::GrokProperty

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

Overview

This processor uses pattern matching to parse and structure unstructured data.

This processor can also extract fields from log messages. For more information about this processor including examples, see grok in the CloudWatch Logs User Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(match:, source: nil) ⇒ GrokProperty

Returns a new instance of GrokProperty.

Parameters:

  • match (String)

    The grok pattern to match against the log event.

  • source (String, nil) (defaults to: nil)

    The path to the field in the log event that you want to parse.



12
13
14
15
16
17
# File 'logs/grok_property.rb', line 12

def initialize(match:, source: nil)
  @match = match
  Jsii::Type.check_type(@match, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "match")
  @source = source
  Jsii::Type.check_type(@source, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "source") unless @source.nil?
end

Instance Attribute Details

#matchString (readonly)

The grok pattern to match against the log event.

For a list of supported grok patterns, see Supported grok patterns in the CloudWatch Logs User Guide.

Returns:

  • (String)


25
26
27
# File 'logs/grok_property.rb', line 25

def match
  @match
end

#sourceString? (readonly)

Note:

Default: '@message'

The path to the field in the log event that you want to parse.

Returns:

  • (String, nil)


30
31
32
# File 'logs/grok_property.rb', line 30

def source
  @source
end

Class Method Details

.jsii_propertiesObject



32
33
34
35
36
37
# File 'logs/grok_property.rb', line 32

def self.jsii_properties
  {
    :match => "match",
    :source => "source",
  }
end

Instance Method Details

#to_jsiiObject



39
40
41
42
43
44
45
46
# File 'logs/grok_property.rb', line 39

def to_jsii
  result = {}
  result.merge!({
    "match" => @match,
    "source" => @source,
  })
  result.compact
end