Implementing Robust Security Auditing with AWS CloudTrail and Service Logs
Auditing answers who did what, when, from where and to which resource. AWS CloudTrail records API activity, and service logs record network, access and application activity. This lesson explains CloudTrail event types, trails and organisation trails, protecting audit logs from tampering, integrating CloudTrail with CloudWatch Logs, and the service and application logs that complete an audit trail.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish between CloudTrail management events, data events, network activity events and Insights events, and event history and trails.
- Explain how organisation trails centralise audit logs and how audit logs are protected from tampering.
- Explain log file integrity validation and CloudTrail integration with CloudWatch Logs and EventBridge.
- Identify the service and application logs that should be enabled for security auditing.
CloudTrail Events
AWS CloudTrail records actions taken by users, roles and AWS services as events. Each event records the identity (including the role session and source identity), the time, the source IP address and user agent, the service and API name, the request parameters, the response elements and whether the call succeeded. Events fall into several types, explained below.
- Management events
- Control-plane operations on resources, such as CreateBucket, RunInstances, AttachRolePolicy and ConsoleLogin. Recorded by default in event history.
- Data events
- Data-plane operations on or in resources, such as S3 GetObject and PutObject, Lambda Invoke, DynamoDB item operations and Secrets Manager GetSecretValue. High volume, charged, and recorded only when a trail or event data store is configured for them, with advanced event selectors to choose resources and actions.
- Network activity events
- API calls made through VPC endpoints from a VPC to AWS services, including denied calls, which helps detect data perimeter violations.
- Insights events
- Generated when CloudTrail detects unusual API call rates or error rates compared with a baseline, as described in the alerting lesson.
Event history shows the last 90 days of management events in each Region at no cost, searchable in the console, but it is not a durable audit log. A trail delivers events continuously to an S3 bucket, typically within about five minutes, and optionally to CloudWatch Logs, for retention and analysis. A trail should be multi-Region, so that activity in every Region, including unused ones, is captured; global service events such as IAM are included.
Organisation Trails and Protection
An organisation trail, created in the management account or by a delegated administrator for CloudTrail, logs events from every member account, including new ones, to a single bucket, with prefixes per account. Member accounts can see the trail but cannot modify or delete it. AWS Control Tower creates one automatically, delivering to the log archive account.
Audit logs must be protected from attackers who want to hide their activity. The controls below are combined.
- Deliver logs to a bucket in a separate log archive account with restricted access, so that compromise of a workload account does not expose or allow deletion of logs.
- Encrypt logs with SSE-KMS using a customer managed key whose policy allows CloudTrail to encrypt and only auditors to decrypt.
- Enable S3 Object Lock in compliance mode or deny deletes in the bucket policy, enable versioning and MFA delete where appropriate.
- Use SCPs to deny
cloudtrail:StopLogging,DeleteTrailandUpdateTrailto everyone except a security role. - Alert on any attempt to change or stop logging, as described in the next lesson.
The following diagram shows the trail, the archive and the controls that protect them.

Protect the audit trail
Log File Integrity Validation
When log file integrity validation is enabled on a trail, CloudTrail creates a digest file every hour containing the SHA-256 hashes of the log files delivered in that hour, signed with a private key, and chains each digest to the previous one. The aws cloudtrail validate-logs command verifies that log files have not been modified, deleted or forged since delivery. Validation provides evidence for forensic investigations and audits that the logs are complete and authentic.
aws cloudtrail validate-logs \
--trail-arn arn:aws:cloudtrail:eu-west-1:111111111111:trail/org-trail \
--start-time 2026-10-01T00:00:00Z --end-time 2026-10-31T23:59:59Z --verboseCloudTrail with CloudWatch Logs and EventBridge
A trail can also send events to a CloudWatch Logs log group, using a role that allows CloudTrail to write. This enables metric filters and alarms on API activity, such as the CIS benchmark alarms for root usage, unauthorised calls and IAM policy changes, and Logs Insights queries over recent events. Separately, EventBridge receives management events directly as AWS API Call via CloudTrail events, which is the lowest-latency path for automated responses. Long-term analysis uses Athena over the trail's S3 bucket, as described in the log analytics lesson; CloudTrail Lake, which offered a managed query store, is closed to new customers.
| Destination | Latency | Use |
|---|---|---|
| S3 (trail) | About 5 minutes | Durable, protected archive; Athena analysis |
| CloudWatch Logs (trail) | Minutes | Metric filters, alarms, Logs Insights |
| EventBridge | Near real time | Automated detection and response |
| Event history | Minutes | 90 days of management events for quick lookups |
Service and Application Logging
CloudTrail does not record network traffic, requests to applications or database queries. A complete audit and security monitoring capability enables the following service logs, each delivered to a central, protected location.
| Log | Records | Destination |
|---|---|---|
| VPC Flow Logs | Accepted and rejected IP traffic metadata for interfaces, subnets or VPCs | S3, CloudWatch Logs or Firehose |
| Route 53 Resolver query logs | DNS queries made from VPCs | S3, CloudWatch Logs or Firehose |
| ELB access logs | Requests to load balancers with client, latency and status | S3 |
| CloudFront logs | Viewer requests at the edge | S3, CloudWatch Logs or Firehose |
| S3 server access logs and CloudTrail data events | Requests to buckets and objects | S3; trail |
| AWS WAF logs | Requests evaluated by web ACLs and matched rules | S3, CloudWatch Logs or Firehose |
| API Gateway access logs | API requests with caller and status | CloudWatch Logs or Firehose |
| RDS and Aurora log exports | Database audit, error and slow query logs | CloudWatch Logs |
| EKS control plane logs | API server, audit and authenticator logs | CloudWatch Logs |
| Application logs | Application events, authentication and authorisation decisions | CloudWatch Logs through agents or drivers |
Applications should log security-relevant events, such as sign-ins, permission changes and access to sensitive records, in structured JSON with the user identity and request ID, without logging secrets or unmasked personal data. AWS Config complements these logs by recording resource configuration history, and Config rules check that the logs above are enabled, for example vpc-flow-logs-enabled, cloudtrail-enabled, multi-region-cloudtrail-enabled and elb-logging-enabled.
Which log records it?
An Auditable Organisation
A regulator requires that a company can show every API action in every account for seven years, prove that logs were not altered, and show network connections to its databases for one year.
-
Trail
Create a multi-Region organisation trail with log file integrity validation, delivering to a log archive account bucket encrypted with SSE-KMS and protected by Object Lock in compliance mode for seven years.
-
Data events
Add data events with advanced event selectors for S3 buckets and Secrets Manager secrets that hold regulated data.
-
Network evidence
Enable VPC Flow Logs for the database subnets to the archive bucket, with a one-year lifecycle.
-
Protection and checks
Apply SCPs that prevent stopping or deleting trails, and Config rules that verify the trail and flow logs remain enabled.
An investigator needs to prove that CloudTrail log files for a period have not been deleted or modified. What feature and command support this?
Show answer
Log file integrity validation, which creates signed, chained digest files, and the aws cloudtrail validate-logs command, which verifies the log files against them.
Exam Tips
Remember for the exam
- Management events are recorded by default (90-day event history); data events and network activity events need a trail or event data store configuration.
- Use a multi-Region organisation trail delivered to a log archive account with SSE-KMS, Object Lock and SCPs against StopLogging and DeleteTrail.
- Log file integrity validation creates hourly signed digest files; verify with aws cloudtrail validate-logs.
- Send trails to CloudWatch Logs for metric filter alarms; EventBridge receives API calls in near real time.
- Enable VPC Flow Logs, Resolver query logs, ELB, CloudFront, WAF, API Gateway, RDS and EKS logs for complete auditing.