Skip to content
v2.278.0

AdvancedEventSelectorProperty Struct ​

Advanced event selectors let you create fine-grained selectors for AWS CloudTrail management, data, and network activity events.

They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events , Logging network activity events , and Logging management events topics in the AWS CloudTrail User Guide .

You cannot apply both event selectors and advanced event selectors to a trail.

Supported CloudTrail event record fields for management events

  • eventCategory (required)
  • eventSource
  • readOnly

The following additional fields are available for event data stores:

  • eventName
  • eventType
  • sessionCredentialFromConsole
  • userIdentity.arn

Supported CloudTrail event record fields for data events

  • eventCategory (required)
  • eventName
  • eventSource
  • eventType
  • resources.ARN
  • resources.type (required)
  • readOnly
  • sessionCredentialFromConsole
  • userIdentity.arn

Supported CloudTrail event record fields for network activity events

  • eventCategory (required)
  • eventSource (required)
  • eventName
  • errorCode - The only valid value for errorCode is VpceAccessDenied .
  • vpcEndpointId

For event data stores for CloudTrail Insights events, AWS Config configuration items, Audit Manager evidence, or events outside of AWS , the only supported field is eventCategory .

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudtrail as cloudtrail } from 'aws-cdk-lib';
const advancedEventSelectorProperty: cloudtrail.CfnEventDataStore.AdvancedEventSelectorProperty = {
  fieldSelectors: [{
    field: 'field',

    // the properties below are optional
    endsWith: ['endsWith'],
    equalTo: ['equalTo'],
    notEndsWith: ['notEndsWith'],
    notEquals: ['notEquals'],
    notStartsWith: ['notStartsWith'],
    startsWith: ['startsWith'],
  }],

  // the properties below are optional
  name: 'name',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudtrail as cloudtrail

advanced_event_selector_property = cloudtrail.CfnEventDataStore.AdvancedEventSelectorProperty(
    field_selectors=[cloudtrail.CfnEventDataStore.AdvancedFieldSelectorProperty(
        field="field",

        # the properties below are optional
        ends_with=["endsWith"],
        equal_to=["equalTo"],
        not_ends_with=["notEndsWith"],
        not_equals=["notEquals"],
        not_starts_with=["notStartsWith"],
        starts_with=["startsWith"]
    )],

    # the properties below are optional
    name="name"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudtrail.*;

AdvancedEventSelectorProperty advancedEventSelectorProperty = AdvancedEventSelectorProperty.builder()
        .fieldSelectors(List.of(AdvancedFieldSelectorProperty.builder()
                .field("field")

                // the properties below are optional
                .endsWith(List.of("endsWith"))
                .equalTo(List.of("equalTo"))
                .notEndsWith(List.of("notEndsWith"))
                .notEquals(List.of("notEquals"))
                .notStartsWith(List.of("notStartsWith"))
                .startsWith(List.of("startsWith"))
                .build()))

        // the properties below are optional
        .name("name")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudTrail;

var advancedEventSelectorProperty = new AdvancedEventSelectorProperty {
    FieldSelectors = new [] { new AdvancedFieldSelectorProperty {
        Field = "field",

        // the properties below are optional
        EndsWith = new [] { "endsWith" },
        EqualTo = new [] { "equalTo" },
        NotEndsWith = new [] { "notEndsWith" },
        NotEquals = new [] { "notEquals" },
        NotStartsWith = new [] { "notStartsWith" },
        StartsWith = new [] { "startsWith" }
    } },

    // the properties below are optional
    Name = "name"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

advancedEventSelectorProperty := &AdvancedEventSelectorProperty{
	FieldSelectors: []interface{}{
		&AdvancedFieldSelectorProperty{
			Field: jsii.String("field"),

			// the properties below are optional
			EndsWith: []*string{
				jsii.String("endsWith"),
			},
			EqualTo: []*string{
				jsii.String("equalTo"),
			},
			NotEndsWith: []*string{
				jsii.String("notEndsWith"),
			},
			NotEquals: []*string{
				jsii.String("notEquals"),
			},
			NotStartsWith: []*string{
				jsii.String("notStartsWith"),
			},
			StartsWith: []*string{
				jsii.String("startsWith"),
			},
		},
	},

	// the properties below are optional
	Name: jsii.String("name"),
}

Properties ​

fieldSelectorsIResolvable | IResolvable | CfnEventDataStore.AdvancedFieldSelectorProperty[]field_selectorstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, AdvancedFieldSelectorProperty]]]fieldSelectorsIResolvableFieldSelectorsIResolvableFieldSelectorsinterface{} required #
Contains all selector statements in an advanced event selector.
nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string #
An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets".