Class: AWSCDK::Logs::ParseJSONProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Logs::ParseJSONProperty
- 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
-
#destination ⇒ String?
readonly
The location to put the parsed key value pair into.
-
#source ⇒ String?
readonly
Path to the field in the log event that will be parsed.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(destination: nil, source: nil) ⇒ ParseJSONProperty
constructor
A new instance of ParseJSONProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(destination: nil, source: nil) ⇒ ParseJSONProperty
Returns a new instance of ParseJSONProperty.
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
#destination ⇒ String? (readonly)
Default: - Placed under root of log event
The location to put the parsed key value pair into.
26 27 28 |
# File 'logs/parse_json_property.rb', line 26 def destination @destination end |
#source ⇒ String? (readonly)
Default: '@message'
Path to the field in the log event that will be parsed.
Use dot notation to access child fields.
33 34 35 |
# File 'logs/parse_json_property.rb', line 33 def source @source end |
Class Method Details
.jsii_properties ⇒ Object
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_jsii ⇒ Object
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 |