Class: AWSCDK::Logs::ParseKeyValueProperty

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

Overview

This processor parses a specified field in the original log event into key-value pairs.

For more information about this processor including examples, see parseKeyValue in the CloudWatch Logs User Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination: nil, field_delimiter: nil, key_prefix: nil, key_value_delimiter: nil, non_match_value: nil, overwrite_if_exists: nil, source: nil) ⇒ ParseKeyValueProperty

Returns a new instance of ParseKeyValueProperty.

Parameters:

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

    The destination field to put the extracted key-value pairs into.

  • field_delimiter (AWSCDK::Logs::KeyValuePairDelimiter, nil) (defaults to: nil)

    The field delimiter string that is used between key-value pairs in the original log events.

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

    If you want to add a prefix to all transformed keys, specify it here.

  • key_value_delimiter (AWSCDK::Logs::KeyValueDelimiter, nil) (defaults to: nil)

    The delimiter string to use between the key and value in each pair in the transformed log event.

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

    A value to insert into the value field in the result, when a key-value pair is not successfully split.

  • overwrite_if_exists (Boolean, nil) (defaults to: nil)

    Specifies whether to overwrite the value if the destination key already exists.

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

    Path to the field in the log event that will be parsed.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'logs/parse_key_value_property.rb', line 16

def initialize(destination: nil, field_delimiter: nil, key_prefix: nil, key_value_delimiter: nil, non_match_value: nil, overwrite_if_exists: nil, source: nil)
  @destination = destination
  Jsii::Type.check_type(@destination, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "destination") unless @destination.nil?
  @field_delimiter = field_delimiter
  Jsii::Type.check_type(@field_delimiter, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5LZXlWYWx1ZVBhaXJEZWxpbWl0ZXIifQ==")), "fieldDelimiter") unless @field_delimiter.nil?
  @key_prefix = key_prefix
  Jsii::Type.check_type(@key_prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyPrefix") unless @key_prefix.nil?
  @key_value_delimiter = key_value_delimiter
  Jsii::Type.check_type(@key_value_delimiter, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbG9ncy5LZXlWYWx1ZURlbGltaXRlciJ9")), "keyValueDelimiter") unless @key_value_delimiter.nil?
  @non_match_value = non_match_value
  Jsii::Type.check_type(@non_match_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nonMatchValue") unless @non_match_value.nil?
  @overwrite_if_exists = overwrite_if_exists
  Jsii::Type.check_type(@overwrite_if_exists, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "overwriteIfExists") unless @overwrite_if_exists.nil?
  @source = source
  Jsii::Type.check_type(@source, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "source") unless @source.nil?
end

Instance Attribute Details

#destinationString? (readonly)

Note:

Default: - Places at the root of the JSON input.

The destination field to put the extracted key-value pairs into.

Returns:

  • (String, nil)


37
38
39
# File 'logs/parse_key_value_property.rb', line 37

def destination
  @destination
end

#field_delimiterAWSCDK::Logs::KeyValuePairDelimiter? (readonly)

Note:

Default: KeyValuePairDelimiter.AMPERSAND

The field delimiter string that is used between key-value pairs in the original log events.



42
43
44
# File 'logs/parse_key_value_property.rb', line 42

def field_delimiter
  @field_delimiter
end

#key_prefixString? (readonly)

Note:

Default: - No prefix is added to the keys.

If you want to add a prefix to all transformed keys, specify it here.

Returns:

  • (String, nil)


47
48
49
# File 'logs/parse_key_value_property.rb', line 47

def key_prefix
  @key_prefix
end

#key_value_delimiterAWSCDK::Logs::KeyValueDelimiter? (readonly)

Note:

Default: KeyValueDelimiter.EQUAL

The delimiter string to use between the key and value in each pair in the transformed log event.



52
53
54
# File 'logs/parse_key_value_property.rb', line 52

def key_value_delimiter
  @key_value_delimiter
end

#non_match_valueString? (readonly)

Note:

Default: - No values is inserted when split is not successful.

A value to insert into the value field in the result, when a key-value pair is not successfully split.

Returns:

  • (String, nil)


57
58
59
# File 'logs/parse_key_value_property.rb', line 57

def non_match_value
  @non_match_value
end

#overwrite_if_existsBoolean? (readonly)

Note:

Default: false

Specifies whether to overwrite the value if the destination key already exists.

Returns:

  • (Boolean, nil)


62
63
64
# File 'logs/parse_key_value_property.rb', line 62

def overwrite_if_exists
  @overwrite_if_exists
end

#sourceString? (readonly)

Note:

Default: '@message'

Path to the field in the log event that will be parsed.

Use dot notation to access child fields.

Returns:

  • (String, nil)


69
70
71
# File 'logs/parse_key_value_property.rb', line 69

def source
  @source
end

Class Method Details

.jsii_propertiesObject



71
72
73
74
75
76
77
78
79
80
81
# File 'logs/parse_key_value_property.rb', line 71

def self.jsii_properties
  {
    :destination => "destination",
    :field_delimiter => "fieldDelimiter",
    :key_prefix => "keyPrefix",
    :key_value_delimiter => "keyValueDelimiter",
    :non_match_value => "nonMatchValue",
    :overwrite_if_exists => "overwriteIfExists",
    :source => "source",
  }
end

Instance Method Details

#to_jsiiObject



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'logs/parse_key_value_property.rb', line 83

def to_jsii
  result = {}
  result.merge!({
    "destination" => @destination,
    "fieldDelimiter" => @field_delimiter,
    "keyPrefix" => @key_prefix,
    "keyValueDelimiter" => @key_value_delimiter,
    "nonMatchValue" => @non_match_value,
    "overwriteIfExists" => @overwrite_if_exists,
    "source" => @source,
  })
  result.compact
end