aws-cdk-lib.aws_events_targets.LogGroupProps

interface LogGroupProps

LanguageType name
.NETAmazon.CDK.AWS.Events.Targets.LogGroupProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#LogGroupProps
Javasoftware.amazon.awscdk.services.events.targets.LogGroupProps
Pythonaws_cdk.aws_events_targets.LogGroupProps
TypeScript (source)aws-cdk-lib » aws_events_targets » LogGroupProps

Customize the CloudWatch LogGroup Event Target.

Example

import * as logs from 'aws-cdk-lib/aws-logs';
declare const logGroup: logs.LogGroup;
declare const rule: events.Rule;

rule.addTarget(new targets.CloudWatchLogGroup(logGroup, {
  logEvent: targets.LogGroupTargetInput.fromObject({
    timestamp: events.EventField.fromPath('$.time'),
    message: events.EventField.fromPath('$.detail-type'),
  }),
}));

Properties

NameTypeDescription
deadLetterQueue?IQueueThe SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.
event?⚠️RuleTargetInputThe event to send to the CloudWatch LogGroup.
logEvent?LogGroupTargetInputThe event to send to the CloudWatch LogGroup.
maxEventAge?DurationThe maximum age of a request that Lambda sends to a function for processing.
retryAttempts?numberThe maximum number of times to retry when the function returns an error.

deadLetterQueue?

Type: IQueue (optional, default: no dead-letter queue)

The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.

The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.


event?⚠️

⚠️ Deprecated: use logEvent instead

Type: RuleTargetInput (optional, default: the entire EventBridge event)

The event to send to the CloudWatch LogGroup.

This will be the event logged into the CloudWatch LogGroup


logEvent?

Type: LogGroupTargetInput (optional, default: the entire EventBridge event)

The event to send to the CloudWatch LogGroup.

This will be the event logged into the CloudWatch LogGroup


maxEventAge?

Type: Duration (optional, default: Duration.hours(24))

The maximum age of a request that Lambda sends to a function for processing.

Minimum value of 60. Maximum value of 86400.


retryAttempts?

Type: number (optional, default: 185)

The maximum number of times to retry when the function returns an error.

Minimum value of 0. Maximum value of 185.