CloudTrail is the audit trail of AWS. It records who did what, when, and from where, which is why it is the first source an investigation turns to when rebuilding the timeline of an incident. The problem is that many accounts rely only on the default event history, which keeps the last 90 days. There is no persistent trail, not every region is covered, and nothing protects the records against tampering.
CloudTrail only really helps if it is reliable at the moment that matters most, which is during an investigation. To get there, you need to decide which event types to record and how broadly, protect the files against changes and deletion (integrity, immutability, and encryption), and pick the few events that deserve an immediate alert. The rest of the log volume has to be organized in a way that lets you investigate without getting lost.
Multi-region and organization trails
Create a multi-region trail, which captures activity in every region, including the ones you do not use. This matters because attackers like to operate in the forgotten regions, where nobody looks. If the environment has several accounts, an organization trail centralizes the events of the whole structure in a single controlled destination.
Store the logs in a separate, restricted account, ideally a dedicated log account. That way, whoever compromises the production account cannot erase the trail that recorded what they did. On the destination bucket, harden the policy to deny deletion and to deny any write that does not come from CloudTrail, and consider Object Lock in compliance mode, which makes the files immutable for the retention period. After all, a log that the intruder can delete loses exactly the value it was supposed to have.
Management events and data events
Management events record control operations, such as creating a role, changing a policy, or opening a security group, and they are the bare minimum. Data events record operations on the data itself (reads and writes of S3 objects, Lambda invocations) and generate much higher volume and cost.
So keep management events always on and turn on data events selectively, only for the most sensitive buckets and functions. Enabling data events everywhere generates cost and noise. On the other hand, enabling them nowhere leaves a blind spot exactly where the data lives.
Integrity, encryption, and analysis
Enable log file integrity validation. It produces signed digest files that let you prove no record was altered or removed, and without that proof the evidence loses weight. Also encrypt the logs with a dedicated KMS key and restrict who can use that key.
A log that nobody queries does not help at all. Send CloudTrail to an analysis tool (CloudWatch Logs, a data lake with Athena, or a SIEM) and create queries and alerts for the critical events. If you do not want to build that analysis infrastructure yourself, CloudTrail Lake is the managed option from AWS: a repository with long retention and SQL queries.
Events that deserve an immediate alert
Coverage only turns into detection when some events trigger an alert right away, without waiting for someone to run a manual query. A small, well-chosen set avoids alert fatigue and already covers the signals most closely tied to compromise and to attempts at covering tracks.
- Use of the root account, which should be extremely rare
- StopLogging, or the deletion or modification of a CloudTrail trail
- Creation of access keys and of new privileged users
- Changes to the trust policy of a role, or attachment of broad policies
- Disabling GuardDuty, Config, or KMS keys
- Changes to SCPs and to the organization structure
Give the trail deactivation alert the highest severity, because that is usually the first step for someone who wants to act without leaving a record. Route these events to a channel with an owner and a response deadline, since a dashboard that nobody watches warns nobody.
Practical checklist
- Create a multi-region trail that covers every region
- Centralize the logs in a dedicated, restricted account
- Keep management events always on
- Enable data events on the most sensitive buckets and functions
- Turn on log file integrity validation
- Make the files immutable with a restrictive policy and Object Lock on the bucket
- Encrypt the logs with a dedicated KMS key
- Restrict who can stop, change, or delete the trail
- Set a retention period that meets your investigation requirements
- Alert on trail deactivation, root usage, and IAM changes
- Run a real investigation as an exercise to validate coverage
Best practices
- Treat disabling CloudTrail as a high-severity event
- Keep the log account separate from the production environment
- Use data events with judgment, where the data that matters lives
- Have reusable investigation queries ready ahead of time
- Set alerts for root usage and IAM changes
- Document where the logs are and how to access them in the middle of an incident
Common mistakes
- Relying only on the 90-day event history
- Older incidents are left without evidence and the investigation stalls.
- Trail limited to a single region
- Malicious activity in the other regions goes unnoticed.
- Logs in the production account itself, with no restrictions
- Whoever compromises the account can erase the audit trail.
- No integrity validation
- There is no way to prove that the records were not tampered with.
- Logs collected and never analyzed
- Critical events raise no alert, and detection time shoots up.
Authorship and review
Cesar Gargiulo
CEO and founder of GUARDIASEC. Technical and editorial lead for the content published in this library.
Published on . Found a technical error? Write to [email protected] and we will correct it and keep a record of the change.