# AWS Log Forensics

### 1. AWS CloudTrail

* **CloudTrail logs** are JSON-formatted and contain detailed event information. Key fields include
* **Purpose**: Logs API calls made in your AWS account.
* **Forensic Use Cases**:
  * Tracking unauthorized access.
  * Reconstructing attack timelines.
  * Detecting privilege escalation or IAM policy changes
* **Correlate Events**
  * Identify **Initial Access**: Look for `ConsoleLogin`, `AssumeRole`, or `CreateAccessKey` events.
  * Detect **Privilege Escalation**: Track `AttachRolePolicy`, `PutUserPolicy`, or `UpdateAssumeRolePolicy`.
  * Analyze **Data Exfiltration**: Investigate `GetObject`, `ListBuckets`, and `GetBucketPolicy`.
  * Monitor **IAM Changes**: Look for `CreateUser`, `DeleteUser`, and `UpdateGroup`.

if we had the log file so we can use **jq** tool to parse the log such as&#x20;

```
jq '.Records[] | select(.eventName == "ConsoleLogin" )' log.json
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mahmoud-shaker.gitbook.io/dfir-notes/aws-cloud-forensics/aws-log-forensics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
