interface LogGroupTargetInputOptions
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.Targets.LogGroupTargetInputOptions |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#LogGroupTargetInputOptions |
Java | software.amazon.awscdk.services.events.targets.LogGroupTargetInputOptions |
Python | aws_cdk.aws_events_targets.LogGroupTargetInputOptions |
TypeScript (source) | aws-cdk-lib » aws_events_targets » LogGroupTargetInputOptions |
Options used when creating a target input template.
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
Name | Type | Description |
---|---|---|
message? | any | The value provided here will be used in the Log "message" field. |
timestamp? | any | The timestamp that will appear in the CloudWatch Logs record. |
message?
Type:
any
(optional, default: EventField.detailType)
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.
timestamp?
Type:
any
(optional, default: EventField.time)
The timestamp that will appear in the CloudWatch Logs record.