ParseKeyValueProperty

class aws_cdk.aws_logs.ParseKeyValueProperty(*, destination=None, field_delimiter=None, key_prefix=None, key_value_delimiter=None, non_match_value=None, overwrite_if_exists=None, source=None)

Bases: object

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.

Parameters:
  • destination (Optional[str]) – The destination field to put the extracted key-value pairs into. Default: - Places at the root of the JSON input.

  • field_delimiter (Optional[KeyValuePairDelimiter]) – The field delimiter string that is used between key-value pairs in the original log events. Default: KeyValuePairDelimiter.AMPERSAND

  • key_prefix (Optional[str]) – If you want to add a prefix to all transformed keys, specify it here. Default: - No prefix is added to the keys.

  • key_value_delimiter (Optional[KeyValueDelimiter]) – The delimiter string to use between the key and value in each pair in the transformed log event. Default: KeyValueDelimiter.EQUAL

  • non_match_value (Optional[str]) – A value to insert into the value field in the result, when a key-value pair is not successfully split. Default: - No values is inserted when split is not successful.

  • overwrite_if_exists (Optional[bool]) – Specifies whether to overwrite the value if the destination key already exists. Default: false

  • source (Optional[str]) – Path to the field in the log event that will be parsed. Use dot notation to access child fields. Default: @message

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_logs as logs

parse_key_value_property = logs.ParseKeyValueProperty(
    destination="destination",
    field_delimiter=logs.KeyValuePairDelimiter.AMPERSAND,
    key_prefix="keyPrefix",
    key_value_delimiter=logs.KeyValueDelimiter.EQUAL,
    non_match_value="nonMatchValue",
    overwrite_if_exists=False,
    source="source"
)

Attributes

destination

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

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

field_delimiter

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

Default:

KeyValuePairDelimiter.AMPERSAND

key_prefix

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

Default:
  • No prefix is added to the keys.

key_value_delimiter

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

Default:

KeyValueDelimiter.EQUAL

non_match_value

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

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

overwrite_if_exists

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

Default:

false

source

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

Use dot notation to access child fields.

Default:

@message