Class Trail
- All Implemented Interfaces:
IConstruct
,IDependable
,IResource
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
import { CloudTrail } from '@aws-cdk/aws-cloudtrail'
const cloudTrail = new CloudTrail(this, 'MyTrail');
NOTE the above example creates an UNENCRYPTED bucket by default, If you are required to use an Encrypted bucket you can supply a preconfigured bucket via TrailProps
Example:
import software.amazon.awscdk.services.cloudtrail.*; IAlias myKeyAlias = Alias.fromAliasName(this, "myKey", "alias/aws/s3"); Trail trail = Trail.Builder.create(this, "myCloudTrail") .sendToCloudWatchLogs(true) .kmsKey(myKeyAlias) .build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Trail
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
Trail
(software.amazon.jsii.JsiiObjectRef objRef) Trail
(software.constructs.Construct scope, String id, TrailProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventSelector
(DataResourceType dataResourceType, List<String> dataResourceValues) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.void
addEventSelector
(DataResourceType dataResourceType, List<String> dataResourceValues, AddEventSelectorOptions options) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.void
addLambdaEventSelector
(List<IFunction> handlers) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.void
addLambdaEventSelector
(List<IFunction> handlers, AddEventSelectorOptions options) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.void
addS3EventSelector
(List<S3EventSelector> s3Selector) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.void
addS3EventSelector
(List<S3EventSelector> s3Selector, AddEventSelectorOptions options) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.The CloudWatch log group to which CloudTrail events are sent.ARN of the CloudTrail trail i.e.ARN of the Amazon SNS topic that's associated with the CloudTrail trail, i.e.void
Log all Lamda data events for all lambda functions the account.void
Log all Lamda data events for all lambda functions the account.void
Log all S3 data events for all objects for all buckets in the account.void
Log all S3 data events for all objects for all buckets in the account.Deprecated.use Trail.onEvent()onCloudTrailEvent
(String id, OnEventOptions options) Deprecated.use Trail.onEvent()static Rule
Create an event rule for when an event is recorded by any Trail in the account.static Rule
onEvent
(software.constructs.Construct scope, String id, OnEventOptions options) Create an event rule for when an event is recorded by any Trail in the account.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.constructs.Construct
toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.awscdk.core.IConstruct
getNode
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
Trail
protected Trail(software.amazon.jsii.JsiiObjectRef objRef) -
Trail
protected Trail(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
Trail
@Stability(Stable) public Trail(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable TrailProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
-
-
Trail
- Parameters:
scope
- This parameter is required.id
- This parameter is required.
-
-
Method Details
-
onEvent
@Stability(Stable) @NotNull public static Rule onEvent(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable OnEventOptions options) Create an event rule for when an event is recorded by any Trail in the account.Note that the event doesn't necessarily have to come from this Trail, it can be captured from any one.
Be sure to filter the event further down using an event pattern.
- Parameters:
scope
- This parameter is required.id
- This parameter is required.options
-
-
onEvent
@Stability(Stable) @NotNull public static Rule onEvent(@NotNull software.constructs.Construct scope, @NotNull String id) Create an event rule for when an event is recorded by any Trail in the account.Note that the event doesn't necessarily have to come from this Trail, it can be captured from any one.
Be sure to filter the event further down using an event pattern.
- Parameters:
scope
- This parameter is required.id
- This parameter is required.
-
addEventSelector
@Stability(Stable) public void addEventSelector(@NotNull DataResourceType dataResourceType, @NotNull List<String> dataResourceValues, @Nullable AddEventSelectorOptions options) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
This method adds an Event Selector for filtering events that match either S3 or Lambda function operations.
Data events: These events provide insight into the resource operations performed on or within a resource. These are also known as data plane operations.
- Parameters:
dataResourceType
- This parameter is required.dataResourceValues
- the list of data resource ARNs to include in logging (maximum 250 entries). This parameter is required.options
- the options to configure logging of management and data events.
-
addEventSelector
@Stability(Stable) public void addEventSelector(@NotNull DataResourceType dataResourceType, @NotNull List<String> dataResourceValues) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
This method adds an Event Selector for filtering events that match either S3 or Lambda function operations.
Data events: These events provide insight into the resource operations performed on or within a resource. These are also known as data plane operations.
- Parameters:
dataResourceType
- This parameter is required.dataResourceValues
- the list of data resource ARNs to include in logging (maximum 250 entries). This parameter is required.
-
addLambdaEventSelector
@Stability(Stable) public void addLambdaEventSelector(@NotNull List<IFunction> handlers, @Nullable AddEventSelectorOptions options) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
This method adds a Lambda Data Event Selector for filtering events that match Lambda function operations.
Data events: These events provide insight into the resource operations performed on or within a resource. These are also known as data plane operations.
- Parameters:
handlers
- the list of lambda function handlers whose data events should be logged (maximum 250 entries). This parameter is required.options
- the options to configure logging of management and data events.
-
addLambdaEventSelector
When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
This method adds a Lambda Data Event Selector for filtering events that match Lambda function operations.
Data events: These events provide insight into the resource operations performed on or within a resource. These are also known as data plane operations.
- Parameters:
handlers
- the list of lambda function handlers whose data events should be logged (maximum 250 entries). This parameter is required.
-
addS3EventSelector
@Stability(Stable) public void addS3EventSelector(@NotNull List<S3EventSelector> s3Selector, @Nullable AddEventSelectorOptions options) When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
This method adds an S3 Data Event Selector for filtering events that match S3 operations.
Data events: These events provide insight into the resource operations performed on or within a resource. These are also known as data plane operations.
- Parameters:
s3Selector
- the list of S3 bucket with optional prefix to include in logging (maximum 250 entries). This parameter is required.options
- the options to configure logging of management and data events.
-
addS3EventSelector
When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
This method adds an S3 Data Event Selector for filtering events that match S3 operations.
Data events: These events provide insight into the resource operations performed on or within a resource. These are also known as data plane operations.
- Parameters:
s3Selector
- the list of S3 bucket with optional prefix to include in logging (maximum 250 entries). This parameter is required.
-
logAllLambdaDataEvents
Log all Lamda data events for all lambda functions the account.Default: false
- Parameters:
options
-- See Also:
-
logAllLambdaDataEvents
@Stability(Stable) public void logAllLambdaDataEvents()Log all Lamda data events for all lambda functions the account.Default: false
-
logAllS3DataEvents
Log all S3 data events for all objects for all buckets in the account.Default: false
- Parameters:
options
-- See Also:
-
logAllS3DataEvents
@Stability(Stable) public void logAllS3DataEvents()Log all S3 data events for all objects for all buckets in the account.Default: false
-
onCloudTrailEvent
@Stability(Deprecated) @Deprecated @NotNull public Rule onCloudTrailEvent(@NotNull String id, @Nullable OnEventOptions options) Deprecated.- use Trail.onEvent()
(deprecated) Create an event rule for when an event is recorded by any Trail in the account.Note that the event doesn't necessarily have to come from this Trail, it can be captured from any one.
Be sure to filter the event further down using an event pattern.
- Parameters:
id
- This parameter is required.options
-
-
onCloudTrailEvent
Deprecated.- use Trail.onEvent()
(deprecated) Create an event rule for when an event is recorded by any Trail in the account.Note that the event doesn't necessarily have to come from this Trail, it can be captured from any one.
Be sure to filter the event further down using an event pattern.
- Parameters:
id
- This parameter is required.
-
getTrailArn
ARN of the CloudTrail trail i.e. arn:aws:cloudtrail:us-east-2:123456789012:trail/myCloudTrail. -
getTrailSnsTopicArn
ARN of the Amazon SNS topic that's associated with the CloudTrail trail, i.e. arn:aws:sns:us-east-2:123456789012:mySNSTopic. -
getLogGroup
The CloudWatch log group to which CloudTrail events are sent.undefined
ifsendToCloudWatchLogs
property is false.
-