Analysing Logs, Metrics and Security Findings
When an alert fires, analysts must establish what happened, how far it spread and whether it is still happening, using logs, metrics and findings from many sources. This lesson explains an investigation workflow, the analysis tools for each kind of evidence, how to correlate them, and how to preserve evidence for forensics.
Learning outcomes
After completing this lesson, you will be able to:
- Describe an investigation workflow from an initial finding to scope and root cause.
- Choose analysis tools for CloudTrail logs, network logs, metrics and findings.
- Explain how to correlate evidence across identities, resources and time.
- Describe evidence preservation and forensic data collection on AWS.
An Investigation Workflow
Security investigations follow a structured sequence, explained below.
- Validate the alert: read the finding and its evidence to decide whether it is a true positive, using GuardDuty finding details, Security Hub context and the triggering event.
- Identify the actors and resources: the IAM principal and its session, source IP addresses, instances, buckets and keys involved.
- Build a timeline: what the actor did before and after the alert, using CloudTrail, service logs and Config history.
- Determine scope: other resources, accounts or Regions the actor touched, and whether data was accessed or exfiltrated.
- Contain, eradicate and recover, in coordination with the analysis, preserving evidence first.
- Report and improve, feeding preventive controls and detection rules.
Investigate a finding
Tools for Each Kind of Evidence
Each evidence source has a preferred analysis tool. The table below summarises them; each tool was described earlier in this guide.
| Evidence | Questions | Tools |
|---|---|---|
| CloudTrail management and data events | Who called what, from where, with what result? | Athena over the trail bucket; Logs Insights on the trail log group; event history for recent events |
| Behaviour of an identity or instance over time | Is this activity normal? What else did it touch? | Amazon Detective profiles and finding groups |
| Network traffic | Which hosts communicated, how much data moved? | VPC Flow Logs in Athena or Logs Insights; Detective; Resolver query logs for DNS |
| Resource configuration changes | What changed and when? | AWS Config timelines and advanced queries |
| Security posture and related findings | What other findings exist for this resource or account? | Security Hub findings and insights |
| Metrics | Did resource usage or error rates change? | CloudWatch metrics, anomaly detection, dashboards |
| Application and web requests | What requests did the attacker send? | ALB, CloudFront, WAF and API Gateway logs in Athena or OpenSearch |
-- Everything a suspicious role session did across the organisation in a time window
SELECT eventtime, eventsource, eventname, awsregion, recipientaccountid, sourceipaddress, errorcode
FROM cloudtrail_logs
WHERE useridentity.arn LIKE 'arn:aws:sts::222222222222:assumed-role/build-role/%'
AND eventtime BETWEEN '2026-11-02T08:00:00Z' AND '2026-11-02T14:00:00Z'
ORDER BY eventtime;Pick the evidence tool
Correlating Evidence
Correlation joins evidence by common keys. The most useful are the access key ID and role session name in CloudTrail, which tie all calls of one session together; source IP addresses, which link API calls, VPC Flow Logs and web logs; resource ARNs and instance IDs, which link findings, Config history and logs; request IDs and trace IDs, which link application logs and X-Ray traces; and time. Using UTC timestamps consistently and synchronised clocks makes timelines reliable. sts:SourceIdentity preserves the original user through role chains, so actions can be attributed to a person even when performed through assumed roles.
Security Hub groups findings by resource, Detective groups related findings into finding groups, and OpenSearch Service's security analytics features can correlate logs from many sources with detection rules for teams that run their own SIEM on AWS.
Preserving Evidence and Forensics
Evidence must be preserved before it is lost or altered. For a compromised EC2 instance, the usual steps are: capture metadata and tags; enable termination protection; isolate the instance with a forensic security group that allows no traffic, or only traffic from a forensic workstation, instead of terminating it; detach it from Auto Scaling groups and load balancers; snapshot its EBS volumes; and capture memory with a tool run through Systems Manager if volatile evidence is needed. Snapshots and logs are copied to a dedicated forensic account with restricted access. GuardDuty Malware Protection can scan snapshots, and Detective supports scope analysis.
For compromised credentials, preservation means keeping the CloudTrail evidence (protected by the controls in the first lesson), then revoking sessions with an aws:TokenIssueTime deny, deactivating keys and rotating secrets. Automating these steps in Step Functions or Systems Manager Automation runbooks ensures they are performed consistently under pressure.
Do not terminate first
Terminating a compromised instance immediately destroys memory and instance store evidence and may prevent understanding of what happened. Isolate and preserve first unless the instance is causing ongoing harm that isolation cannot stop.
Investigating Unexpected Data Access
Macie reports that an S3 bucket with customer data became publicly readable, and GuardDuty reports anomalous S3 GetObject calls from an unfamiliar IP address shortly afterwards.
-
Who changed the policy
Query CloudTrail in Athena for PutBucketPolicy and DeletePublicAccessBlock on the bucket: a developer role session made the change from the corporate network during a deployment.
-
What was accessed
Query CloudTrail S3 data events for GetObject on the bucket from the external IP to list objects read and bytes transferred.
-
Scope
Use Detective to check whether the external IP interacted with other resources, and search VPC Flow Logs and WAF logs for the same address.
-
Contain and fix
Restore the public access block, confirm with Config, rotate any exposed credentials and add an RCP and a hook that prevent public bucket policies.
Which keys are most useful for linking all API calls made by one assumed-role session across accounts and Regions?
Show answer
The role session ARN (assumed-role ARN with the session name) and the access key ID of the temporary credentials in CloudTrail, together with sts:SourceIdentity where it is set.
Exam Tips
Remember for the exam
- Investigate in order: validate, identify actors and resources, build a timeline, determine scope, contain and recover, report.
- Use Athena over CloudTrail for organisation-wide API analysis, Detective for behaviour and scope, Config for configuration history and Flow Logs for network evidence.
- Correlate on access key ID, role session, source IP, resource ARN, request ID and time.
- Preserve evidence before termination: isolate, snapshot, capture memory, copy to a forensic account; revoke sessions with aws:TokenIssueTime.