class CloudWatchLogGroup
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.Targets.CloudWatchLogGroup |
Java | software.amazon.awscdk.services.events.targets.CloudWatchLogGroup |
Python | aws_cdk.aws_events_targets.CloudWatchLogGroup |
TypeScript (source) | @aws-cdk/aws-events-targets » CloudWatchLogGroup |
Implements
IRule
Use an AWS CloudWatch LogGroup as an event rule target.
Example
import * as logs from '@aws-cdk/aws-logs';
const logGroup = new logs.LogGroup(this, 'MyLogGroup', {
logGroupName: 'MyLogGroup',
});
const rule = new events.Rule(this, 'rule', {
eventPattern: {
source: ["aws.ec2"],
},
});
rule.addTarget(new targets.CloudWatchLogGroup(logGroup));
Initializer
new CloudWatchLogGroup(logGroup: ILogGroup, props?: LogGroupProps)
Parameters
- logGroup
ILog
Group - props
Log
Group Props
Methods
Name | Description |
---|---|
bind(_rule, _id?) | Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup. |
bind(_rule, _id?)
public bind(_rule: IRule, _id?: string): RuleTargetConfig
Parameters
- _rule
IRule
- _id
string
Returns
Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup.