Class: AWSCDK::Logs::ParseJSONProperty

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

Overview

This processor parses log events that are in JSON format.

It can extract JSON key-value pairs and place them under a destination that you specify. Additionally, because you must have at least one parse-type processor in a transformer, you can use ParseJSON as that processor for JSON-format logs, so that you can also apply other processors, such as mutate processors, to these logs. For more information about this processor including examples, see parseJSON in the CloudWatch Logs User Guide.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination: nil, source: nil) ⇒ ParseJSONProperty

Returns a new instance of ParseJSONProperty.

Parameters:

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

    The location to put the parsed key value pair into.

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

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



15
16
17
18
19
20
# File 'logs/parse_json_property.rb', line 15

def initialize(destination: nil, source: nil)
  @destination = destination
  Jsii::Type.check_type(@destination, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "destination") unless @destination.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: - Placed under root of log event

The location to put the parsed key value pair into.

Returns:

  • (String, nil)


26
27
28
# File 'logs/parse_json_property.rb', line 26

def destination
  @destination
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)


33
34
35
# File 'logs/parse_json_property.rb', line 33

def source
  @source
end

Class Method Details

.jsii_propertiesObject



35
36
37
38
39
40
# File 'logs/parse_json_property.rb', line 35

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

Instance Method Details

#to_jsiiObject



42
43
44
45
46
47
48
49
# File 'logs/parse_json_property.rb', line 42

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