# Windows Event Logs

### Purpose and Function

**Windows Event Logs** are the primary diagnostic and auditing mechanism of the operating system. They are standardized logs maintained by Windows and various applications to record significant occurrences, errors, warnings, and informational messages. They function as a detailed, chronological diary of system activity, crucial for troubleshooting, security auditing, and forensic analysis.

From a DFIR perspective, Event Logs are an indispensable source of high-fidelity, time-stamped evidence for a vast range of system-level activities. They often contain the only record of specific user actions, service manipulations, and anti-forensic techniques.

### Location and Structure

Modern event logs are stored as binary XML (`.evtx`) files, which allows for structured and extensible logging.

* **Location:** `C:\Windows\System32\winevt\Logs\`

Windows organizes events into different logs, known as **channels**, based on their source or purpose. Key channels frequently examined during an investigation include:

* **System:** Logs events generated by Windows system components, such as service start/stop events, driver loading issues, and system time changes.
* **Security:** Records security-related events based on the system's audit policy. This includes logon/logoff attempts, account management, policy changes, and, critically, **log clearing events**. Accessing this log requires administrative privileges.
* **Application:** Contains events logged by installed applications (non-OS specific). Application crashes and errors are often recorded here.
* **Setup:** Records events related to the installation of software and Windows updates.
* **Applications and Services Logs:** A broader category containing numerous specific logs for individual Windows features or applications (e.g., `Microsoft-Windows-TaskScheduler/Operational`, `Microsoft-Windows-PowerShell/Operational`, `Microsoft-Windows-Ntfs/Operational`).

The entire logging system is dependent on the **Windows Event Log service (`eventlog`)**. If this service is stopped, no new events will be recorded.

### Stored Metadata and Key Event IDs

Each event log entry is a structured record containing valuable metadata, including:

* **Event ID:** A unique number that identifies the specific type of event.
* **Timestamp:** A high-precision timestamp indicating when the event was logged.
* **Source:** The name of the software or component that generated the event.
* **Level:** The severity of the event (e.g., Information, Warning, Error, Critical).
* **User:** The user account associated with the event.
* **Event Data:** A detailed, often XML-formatted description of the event, containing specific information like process names, file paths, or error codes.

While there are thousands of Event IDs, certain ones are of paramount importance in forensic investigations:

* **Event ID 4624 (Security):** Successful user logon.
* **Event ID 4616 (Security):** System time was changed.
* **Event ID 1102 (Security):** The Security audit log was cleared. **This is a major indicator of anti-forensic activity.**
* **Event ID 104 (System):** A log file (other than Security) was cleared.
* **Event ID 7036 (System):** A service entered the running or stopped state (e.g., the `SysMain` or `eventlog` service).
* **Event ID 3079 (Application):** The USN Journal was deleted, often by `fsutil.exe`.

### Forensic Value

Event Logs provide a trusted, system-generated record of activities that is difficult for a typical user to manipulate without leaving traces.

* **Detecting Anti-Forensic Activities:** This is one of their most critical roles. Event logs explicitly record the clearing of other logs (IDs 1102, 104), the deletion of the USN Journal (ID 3079), and changes to the system time (ID 4616). These actions are direct evidence of an attempt to cover tracks.
* **Tracking System and Service Manipulation:** Logs provide a timeline of when critical services (like `SysMain` for Prefetching) were stopped and started, which can be correlated with the execution of malicious software.
* **Auditing User Activity:** Logon and logoff events help establish a timeline of when a user was active on the system.
* **Corroborating Evidence:** An event in the log can provide the crucial context for another piece of evidence. For example, a Prefetch file for `cmd.exe` can be correlated with an Event ID 4616 showing that `cmd.exe` was the process that initiated a system time change.

Analysis is typically performed using the built-in **Event Viewer (`eventvwr.msc`)**, which allows for filtering and searching. For large-scale analysis, command-line tools like `wevtutil.exe` or specialized parsers like Eric Zimmerman's `EvtxECmd` are used.

***

#### Reflection points (SS Contest)

For a ScreenSharer, Event Logs are the ultimate arbiter of truth for system-level bypasses. They provide undeniable proof of tampering.

* **The Tattletale Logs:** Event Logs are designed to report on their own manipulation. Finding **Event ID 1102** (Security log cleared) or **Event ID 104** (other logs cleared) is a "smoking gun" that proves the player intentionally tried to wipe their activity history.
* **Catching the Journal Deleter:** The **Event ID 3079** is a direct and conclusive piece of evidence. If a player deletes their USN Journal to hide file deletions or replacements, this event will be logged, turning a sophisticated bypass attempt into a simple, bannable offense.
* **Exposing Service Tampering:** A common bypass is to stop the `SysMain` service to prevent Prefetch logging. An SSer can check the System log for **Event ID 7036** from the "Service Control Manager" source to see the exact time the `SysMain` service was stopped, proving the manipulation.
* **Proving Time Manipulation:** A player might change their system time to try and confuse timestamp-based analysis. **Event ID 4616** not only records that the time was changed but often logs *which process* initiated the change. A time change made by `cmd.exe` is a clear indication of manual user action.


---

# 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://itzicehere.gitbook.io/redlotusguide/advanced-explanation-of-artifacts/system-configuration-and-persistence/windows-event-logs.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.
