24 of 50 in All Controls
aws

Selective CloudTrail Data Events Logging with Cost Guardrails

IDAWS-LOG-002
Severity
high
Automation
Auto
Category
logging
Enforcementmandatory
Complexity / Impact
medium(low impact)
Risk Profile
high likelihood(low residual)
Cloud Scopeaws:root
Environments
all
Target Resources
AWS::CloudTrail::TrailAWS::S3::BucketAWS::DynamoDB::TableAWS::Lambda::Function
Services
cloudtrails3dynamodblambdaiam
Tags
loggingcloudtraildata-eventss3dynamodblambdalanding-zonecost-optimization
Frameworks
NIST 800-53ISO 27001SOC 2PCI DSSHIPAA
Governance
Cloud Security (quarterly)
Created
2026-05-03
Last Updated
2026-08-21

Specification & Description

Enable CloudTrail Data event logging for sensitive data stores (S3 objects, DynamoDB tables, and Lambda invocations) using Advanced Event Selectors while filtering out benign AWS internal service events to control ingestion costs.

Technical Specifications

While AWS CloudTrail Management Events capture control-plane operations (e.g., CreateBucket, AttachRolePolicy), they do not record data-plane operations (e.g., S3 GetObject, PutObject, DeleteObject, DynamoDB GetItem, or Lambda Invoke).

1. High-Value Data Plane Auditing

  • Data events provide granular forensic trails required to detect unauthorized data exfiltration, insider threats, and ransomware encryption attempts.
  • Organizations must enable Data event logging on S3 buckets containing sensitive data (PII, financial data, secret stores) and production DynamoDB tables.

2. Cost & Volume Management via Advanced Event Selectors

  • Unfiltered Data event logging across high-throughput data lakes or transient utility buckets causes exponential CloudTrail ingestion and S3 storage costs ($0.10 per 100,000 data events).
  • CloudTrail Advanced Event Selectors must be utilized to:
    • Target specific sensitive resource ARNs or prefix patterns.
    • Explicitly exclude AWS service-initiated events (readOnly = true or eventType = AwsServiceEvent) to eliminate repetitive internal read noise.
    • Separate read-only audits from write-only modifications where appropriate.

Security Rationale

Management events show who modified infrastructure, but Data events prove what data was actually accessed, read, or exfiltrated. Without data-plane audit trails on sensitive buckets and databases, security teams cannot determine the blast radius or data loss impact of compromised credentials. Filtering service noise ensures comprehensive security visibility without uncontrolled cost surges.

Business & Security Impact

Absence of data event logging creates blind spots in data access patterns, leaving unauthorized downloads or deletions undetectable. Conversely, unconstrained logging across all buckets causes massive log fatigue and severe unexpected billing spikes.

Compliance Framework Mappings (5)

Regulatory baselines and industry standards mapped to this control specification.

Beta
Framework / StandardMapped Requirements & ControlsControls
NIST 800-53 Rev 5NIST 800-53
AU-2AU-3AU-12AC-3
4
ISO 27001:2022ISO 27001
A.8.15A.8.12
2
SOC 2SOC 2
CC6.1CC7.2
2
PCI DSS v4.0PCI DSS
10.2.110.2.2
2
HIPAA Security RuleHIPAA
164.312(b)
1

* Compliance framework mappings are provided for informational architectural reference. Always verify control alignment against your organization's formal audit requirements.

Automated Detection & Rule Logic

Detection Engine: aws-api • Automated: Yes

Inspects organization trails to verify that Advanced Event Selectors or Event Selectors are configured to capture Data events for sensitive resource types (AWS::S3::Object, AWS::DynamoDB::Table).

AWS CLI: Check Trail Event Selectorsbash
aws cloudtrail get-event-selectors \
  --trail-name org-security-trail \
  --output json
Python (Boto3): Verify CloudTrail Data Events Configurationpython
import json
import boto3

cloudtrail = boto3.client('cloudtrail')

# Recognized AWS CloudTrail Data Event Resource Types across AWS services:
# S3 (AWS::S3::Object), DynamoDB (AWS::DynamoDB::Table), Lambda (AWS::Lambda::Function),
# KMS (AWS::KMS::Key), Secrets Manager (AWS::SecretsManager::Secret), Bedrock (AWS::Bedrock::KnowledgeBase), etc.
DEFAULT_REQUIRED_TYPES = [
    'AWS::S3::Object',
    'AWS::DynamoDB::Table',
    'AWS::Lambda::Function'
]

def check_data_events(trail_name=None, required_types=None):
    """
    Audits CloudTrail data event logging configuration across primary organization trails.
    Supports both AdvancedEventSelectors and legacy EventSelectors (DataResources)
    across all AWS data event resource types.
    """
    if required_types is None:
        required_types = DEFAULT_REQUIRED_TYPES

    # 1. Discover primary trails (includeShadowTrails=False prevents cross-region shadow lookup errors)
    if trail_name:
        trails_to_check = [{'Name': trail_name, 'TrailARN': trail_name}]
    else:
        all_trails = cloudtrail.describe_trails(includeShadowTrails=False).get('trailList', [])
        trails_to_check = [
            t for t in all_trails 
            if t.get('IsOrganizationTrail', False) or t.get('IsMultiRegionTrail', False)
        ]

    if not trails_to_check:
        return {"status": "NON_COMPLIANT", "reason": "No primary Organization or Multi-Region trails found in this region."}

    results = []
    for t in trails_to_check:
        t_name = t.get('Name')
        t_arn = t.get('TrailARN', t_name)

        try:
            response = cloudtrail.get_event_selectors(TrailName=t_arn)
            monitored_types = set()

            # Check Advanced Event Selectors
            for sel in response.get('AdvancedEventSelectors', []):
                for field in sel.get('FieldSelectors', []):
                    if field.get('Field') == 'resources.type':
                        monitored_types.update(field.get('Equals', []))
                        monitored_types.update(field.get('StartsWith', []))

            # Check Legacy Event Selectors (DataResources)
            for sel in response.get('EventSelectors', []):
                for dr in sel.get('DataResources', []):
                    dr_type = dr.get('Type')
                    if dr_type:
                        monitored_types.add(dr_type)

            monitored_list = sorted(list(monitored_types))
            has_data_events = len(monitored_list) > 0
            has_sensitive_coverage = any(r_type in monitored_list for r_type in required_types)

            results.append({
                "trail": t_name,
                "status": "COMPLIANT" if has_sensitive_coverage else "NON_COMPLIANT",
                "monitored_resources": monitored_list,
                "has_data_events": has_data_events
            })
        except Exception as e:
            results.append({"trail": t_name, "status": "ERROR", "error": str(e)})

    return results

if __name__ == "__main__":
    result = check_data_events()
    print(json.dumps(result, indent=2))

Preventative Enforcement Policies

CloudTrail Advanced Event Selectors for Sensitive S3 & DynamoDBjson
[
  {
    "Name": "LogSensitiveS3DataEvents",
    "FieldSelectors": [
      { "Field": "eventCategory", "Equals": ["Data"] },
      { "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
      { "Field": "resources.ARN", "StartsWith": ["arn:aws:s3:::sensitive-data-", "arn:aws:s3:::customer-pii-"] },
      { "Field": "readOnly", "Equals": ["false"] }
    ]
  },
  {
    "Name": "ExcludeAWSServiceInternalEvents",
    "FieldSelectors": [
      { "Field": "eventCategory", "Equals": ["Data"] },
      { "Field": "eventType", "NotEquals": ["AwsServiceEvent"] }
    ]
  }
]
Terraform: CloudTrail with Advanced Event Selectorshcl
resource "aws_cloudtrail" "data_events_trail" {
  name                          = "org-data-events-trail"
  s3_bucket_name                = var.log_archive_bucket_name
  include_global_service_events = false
  is_multi_region_trail         = true
  is_organization_trail         = true
  enable_log_file_validation    = true
  kms_key_id                    = var.cloudtrail_kms_key_arn

  advanced_event_selector {
    name = "S3SensitiveDataEvents"
    field_selector {
      field  = "eventCategory"
      equals = ["Data"]
    }
    field_selector {
      field  = "resources.type"
      equals = ["AWS::S3::Object"]
    }
    field_selector {
      field       = "resources.ARN"
      starts_with = ["arn:aws:s3:::sensitive-data-"]
    }
  }

  advanced_event_selector {
    name = "DynamoDBSensitiveTables"
    field_selector {
      field  = "eventCategory"
      equals = ["Data"]
    }
    field_selector {
      field  = "resources.type"
      equals = ["AWS::DynamoDB::Table"]
    }
  }
}

Remediation Guide & Automation

Configure CloudTrail Advanced Event Selectors from the AWS Organizations Management account or delegated administrator to record data plane events for sensitive S3 buckets, DynamoDB tables, and Lambda functions while filtering out routine AWS internal service events.

Step-by-Step Instructions

  1. Identify all sensitive S3 buckets, DynamoDB tables, and critical Lambda functions across member accounts.
  2. Create an Advanced Event Selector configuration JSON targeting those resource ARNs.
  3. Apply the selectors to the organization trail targeting the centralized Log Archive bucket.
  4. Add exclusions for benign internal AWS service events (e.g. eventType != AwsServiceEvent).
  5. Verify data event delivery in the central Log Archive S3 bucket.
Configuration (JSON): advanced-selectors.jsonjson
[
  {
    "Name": "ManagementEventsBaseline",
    "FieldSelectors": [
      { "Field": "eventCategory", "Equals": ["Management"] }
    ]
  },
  {
    "Name": "SelectiveS3ObjectDataEvents",
    "FieldSelectors": [
      { "Field": "eventCategory", "Equals": ["Data"] },
      { "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
      { "Field": "resources.ARN", "StartsWith": ["arn:aws:s3:::sensitive-data-", "arn:aws:s3:::customer-pii-"] },
      { "Field": "eventType", "NotEquals": ["AwsServiceEvent"] }
    ]
  },
  {
    "Name": "SelectiveDynamoDBDataEvents",
    "FieldSelectors": [
      { "Field": "eventCategory", "Equals": ["Data"] },
      { "Field": "resources.type", "Equals": ["AWS::DynamoDB::Table"] },
      { "Field": "eventType", "NotEquals": ["AwsServiceEvent"] }
    ]
  },
  {
    "Name": "SelectiveLambdaInvocationEvents",
    "FieldSelectors": [
      { "Field": "eventCategory", "Equals": ["Data"] },
      { "Field": "resources.type", "Equals": ["AWS::Lambda::Function"] },
      { "Field": "eventType", "NotEquals": ["AwsServiceEvent"] }
    ]
  }
]
AWS CLI: Apply Advanced Event Selectors to Organization Trailbash
# Apply the advanced event selectors configuration to the organization trail
aws cloudtrail put-event-selectors \
  --trail-name org-security-trail \
  --advanced-event-selectors file://advanced-selectors.json

We value your privacy

We use analytics cookies to understand how visitors interact with our site and to improve the user experience. You can choose to accept or decline these cookies.