AddKeysProperty

class aws_cdk.aws_logs.AddKeysProperty(*, entries)

Bases: object

This processor adds new key-value pairs to the log event.

For more information about this processor including examples, see addKeys in the CloudWatch Logs User Guide.

Parameters:

entries (Sequence[Union[AddKeyEntryProperty, Dict[str, Any]]]) – An array of objects, where each object contains information about one key to add to the log event.

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

entries

An array of objects, where each object contains information about one key to add to the log event.