LogGroupTargetInput

class aws_cdk.aws_events_targets.LogGroupTargetInput

Bases: object

The input to send to the CloudWatch LogGroup target.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_logs as logs
# log_group: logs.LogGroup
# rule: events.Rule


rule.add_target(targets.CloudWatchLogGroup(log_group,
    log_event=targets.LogGroupTargetInput.from_object(
        timestamp=events.EventField.from_path("$.time"),
        message=events.EventField.from_path("$.detail-type")
    )
))

Methods

abstract bind(rule)

Return the input properties for this input object.

Parameters:

rule (IRule) –

Return type:

RuleTargetInputProperties

Static Methods

classmethod from_object(*, message=None, timestamp=None)

Pass a JSON object to the the log group event target.

May contain strings returned by EventField.from() to substitute in parts of the matched event.

Parameters:
  • message (Any) – The value provided here will be used in the Log “message” field. This field must be a string. If an object is passed (e.g. JSON data) it will not throw an error, but the message that makes it to CloudWatch logs will be incorrect. This is a likely scenario if doing something like: EventField.fromPath(‘$.detail’) since in most cases the detail field contains JSON data. Default: EventField.detailType

  • timestamp (Any) – The timestamp that will appear in the CloudWatch Logs record. Default: EventField.time

Return type:

RuleTargetInput