Class: AWSCDK::Logs::CfnTransformer::ParseJSONProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
logs/cfn_transformer.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.



1227
1228
1229
1230
1231
1232
# File 'logs/cfn_transformer.rb', line 1227

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)

The location to put the parsed key value pair into.

If you omit this parameter, it is placed under the root node.



1240
1241
1242
# File 'logs/cfn_transformer.rb', line 1240

def destination
  @destination
end

#sourceString? (readonly)

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

Use dot notation to access child fields. For example, store.book



1247
1248
1249
# File 'logs/cfn_transformer.rb', line 1247

def source
  @source
end

Class Method Details

.jsii_propertiesObject



1249
1250
1251
1252
1253
1254
# File 'logs/cfn_transformer.rb', line 1249

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

Instance Method Details

#to_jsiiObject



1256
1257
1258
1259
1260
1261
1262
1263
# File 'logs/cfn_transformer.rb', line 1256

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