Sub topic 4
Searching recent activity with Event history
This chapter assumes you can read a CloudTrail event record, know the difference between management and data events, and can run basic AWS CLI commands. It covers the search tool that needs no setup: Event history.
What Event history is
Event history is a built-in, searchable record of the last 90 days of management events in each Region. It is on by default in every account. You do not create it, pay for it, or configure it.
It is not a trail. A trail delivers events to S3 and keeps them as long as you choose. Event history only lets you look back over a rolling window.
| Feature | Event history | Trail |
|---|---|---|
| Setup | None | You create it |
| Retention | 90 days, rolling | Until you delete the logs |
| Event types | Management events only | Management, data, and Insights |
| Scope | One Region at a time | One Region or all Regions |
| Delivery to S3 | No | Yes |
Data events, such as S3 object reads, never appear in Event history. If you need them, you need a trail.
Searching with lookup-events
The lookup-events command searches Event history from the CLI. This example finds recent StopLogging calls, which are worth checking because someone who turns off logging may be hiding activity.
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=EventName,AttributeValue=StopLogging \
--max-results 10The command searches only the Region your CLI is configured for. Add --region to search another one.
Each result is a JSON object. The CloudTrailEvent field holds the full event record as a string. That is the same record you learned to read in the previous chapters, with fields such as userIdentity, eventTime, and sourceIPAddress.
Lookup attributes
You can filter on one attribute per call. The supported keys are:
EventIdEventNameReadOnlyUsernameResourceTypeResourceNameEventSourceAccessKeyId
Two limits matter in practice:
- You can supply only one attribute and one value per request. You cannot combine
UsernameandEventNamein a single call. - To narrow results further, add a time range with
--start-timeand--end-time, or filter the output on your side.
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=Username,AttributeValue=alice \
--start-time 2026-11-19T00:00:00Z \
--end-time 2026-11-21T00:00:00Z \
--query 'Events[?EventName==`StopLogging`].[EventTime,EventName,Username]' \
--output tableHere the service filters by user and time. The --query option then filters by event name on your machine. This is the usual workaround for the one-attribute limit.
How a search flows
Common errors and limits
- Empty results in the wrong Region. Event history is per Region. Most IAM events are recorded in
us-east-1, and Region-specific resources are recorded where they live. Check the Region first. - Missing recent events. Events can take several minutes to appear. Do not conclude that nothing happened after a search a minute later.
- Throttling.
lookup-eventshas a low request rate per account per Region. Avoid running it in tight loops. The CLI paginates for you, but large time ranges are slow. - Expecting data events. Object-level S3 activity will not show up. A trail with data event selectors is required, as covered in the next chapter.
- Expecting results older than 90 days. Older events are gone unless a trail or CloudTrail Lake captured them.
Using the console
The CloudTrail console offers the same search under Event history. You pick one attribute from a drop-down, enter a value, and set a time range. You can download the results as CSV or JSON. The console is useful for quick exploration. The CLI is better when you want to script a check or filter with --query.
Exercise
A teammate says someone read objects from an S3 bucket 30 days ago, and asks you to confirm using Event history. Why will this not work, and what would you need to have had in place?
Show answer
Reading S3 objects is a data event, and Event history records only management events. You would have needed a trail (or CloudTrail Lake event data store) with data event selectors for that bucket enabled before the reads happened.
Exercise
You want every call made by the user alice that was a StopLogging call. lookup-events accepts only one lookup attribute. How do you get this result with one command?
Show answer
Filter by one attribute on the service side, for example Username=alice, then filter the rest on the client with --query, such as --query 'Events[?EventName==StopLogging]'.