ParserProcessorType

class aws_cdk.aws_logs.ParserProcessorType(*values)

Bases: Enum

Types of configurable parser processors.

Defines the various parser types that can be used to process log events.

ExampleMetadata:

infused

Example:

# Create a log group
log_group = logs.LogGroup(self, "MyLogGroup")

# Create a JSON parser processor
json_parser = logs.ParserProcessor(
    type=logs.ParserProcessorType.JSON
)

# Create a processor to add keys
add_keys_processor = logs.JsonMutatorProcessor(
    type=logs.JsonMutatorType.ADD_KEYS,
    add_keys_options=logs.AddKeysProperty(
        entries=[logs.AddKeyEntryProperty(
            key="metadata.transformed_in",
            value="CloudWatchLogs"
        )]
    )
)

# Create a transformer with these processors
logs.Transformer(self, "Transformer",
    transformer_name="MyTransformer",
    log_group=log_group,
    transformer_config=[json_parser, add_keys_processor]
)

Attributes

CSV

Parse log entries in CSV format.

GROK

Parse log entries using Grok patterns.

JSON

Parse log entries as JSON.

KEY_VALUE

Parse log entries as key-value pairs.

OCSF

Parse logs to OCSF format.