#Why this matters
In earlier lessons you audited Windows services, Run keys and PowerShell Event ID 4104 on a single host. During an incident or a digital-forensics (raqamli-izquarlik) investigation, however, defenders rarely get the whole story from one log source. An attacker may authenticate over SMB, install a malicious service, drop a binary into ProgramData, query an external domain and wipe the local Security log.
Default Windows logging records only basic authentication and service events, leaving process trees, file hashes and DNS lookups blind. Combining tuned Windows Advanced Audit Policy with Sysinternals Sysmon produces the high-fidelity timeline needed to reconstruct an intrusion end to end.
#Windows Event Log architecture and native auditing
Windows stores event logs as binary .evtx files in C:\Windows\System32\winevt\Logs\. Core channels include Security, System and Application, alongside Applications and Services Logs such as Microsoft-Windows-PowerShell/Operational and Microsoft-Windows-Sysmon/Operational.
Native security auditing is governed by Advanced Audit Policy subcategories rather than broad legacy categories. You can inspect active audit settings with auditpol /get /category:*. To make native process creation (Event ID 4688) useful, enable both Audit Process Creation and the Group Policy setting Include command line in process creation events; otherwise CommandLine stays empty.
| Channel | Event ID | Meaning | Key forensic fields |
|---|---|---|---|
Security |
4624 / 4625 |
Successful / failed logon | TargetUserName, LogonType, IpAddress |
Security |
4672 |
Special privileges assigned | SubjectUserName, PrivilegeList |
Security |
4688 |
Process creation | NewProcessName, ParentProcessName, CommandLine |
Security / System |
4697 / 7045 |
New service installed | ServiceName, ImagePath (ServiceFileName) |
Security |
4720 |
User account created | TargetUserName, SubjectUserName |
Security |
1102 |
Security audit log cleared | SubjectUserName |
Pay close attention to LogonType in 4624 and 4625:
- Type 2 (Interactive): local keyboard/console sign-in.
- Type 3 (Network): SMB file shares, WinRM, or remote RPC/service management.
- Type 7 (Unlock): workstation screen unlock.
- Type 10 (RemoteInteractive): Remote Desktop Protocol (RDP) session.
#Sysmon telemetry: bridging the visibility gap
Native Windows logs still miss several attacker footprints: file hashes on process launch, DLL loads, cross-process thread injection, granular registry value writes and process-attributed DNS queries. Sysmon (System Monitor) fills those gaps through a kernel driver and system service writing to Microsoft-Windows-Sysmon/Operational.
| Sysmon ID | Event type | Typical detection use |
|---|---|---|
1 |
ProcessCreate | Full command line, ParentImage, Hashes, ProcessGuid |
3 |
NetworkConnect | Outbound TCP/UDP sockets mapped to Image and ProcessGuid |
7 |
ImageLoad | DLL loading (useful for DLL sideloading hunts when tightly filtered) |
8 |
CreateRemoteThread | Cross-process memory injection into another process |
11 |
FileCreate | Payload drops in Users, Temp or ProgramData |
12, 13, 14 |
RegistryEvent | Run key and Services persistence writes (TargetObject, Details) |
22 |
DNSEvent | QueryName and QueryResults attributed to the calling process |
A vital Sysmon concept is ProcessGuid. Windows reuses numeric ProcessId (PID) values quickly once a process exits. Sysmon assigns each new process instance a unique ProcessGuid (and records ParentProcessGuid from its parent), allowing analysts to link Event ID 1, 3, 11, 13 and 22 records accurately hours or days later.
Sysmon ships without filtering rules by default. In production or labs, load a curated XML policy (sysmon64.exe -accepteula -i sysmonconfig.xml) using RuleGroup blocks with onmatch="exclude" to suppress noisy trusted baseline activity (such as routine browser DLL loads) while using onmatch="include" on high-risk directories (AppData, ProgramData, Temp) and persistence registry paths.
- Endpoint Telemetry (Security + 4104 + Sysmon)Local .evtx channels written by kernel and audit providers
- Collection (WEF or SIEM Agent)Forward events off-host in near real time
- Correlation (ProcessGuid & LogonType)Link authentication, process tree, registry and network events
- Analyst Triage (wevtutil / Get-WinEvent / Sigma)Scope root cause and contain affected host
#Querying live channels and .evtx files
During live triage or offline forensic analysis of an exported .evtx file, wevtutil and PowerShell's Get-WinEvent filter events quickly using XPath queries.
$ wevtutil qe C:\Cases\ws-lab-03-sysmon.evtx /lf:true /q:"*[System[(EventID=1)]]" /c:1 /rd:true /f:text
Event[0]:
Log Name: Microsoft-Windows-Sysmon/Operational
Event ID: 1
Task: Process Create (rule: ProcessCreate)
Description:
Process Create:
UtcTime: 2026-11-19 04:18:11.204
ProcessGuid: {A1B2C3D4-1122-3344-5566-0000000019A4}
ProcessId: 4812
Image: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
CommandLine: powershell.exe -NoP -W Hidden -Enc RwBlAHQALQBEAGEAdABlAA==
ParentProcessGuid: {A1B2C3D4-1122-3344-5566-000000001802}
ParentImage: C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE
$ powershell.exe -NoProfile -Command "Get-WinEvent -Path C:\Cases\ws-lab-03-sysmon.evtx -FilterXPath '*[System[(EventID=3 or EventID=22)] and EventData[Data[@Name=\"ProcessGuid\"]=\"{A1B2C3D4-1122-3344-5566-0000000019A4}\"]]' | Format-List TimeCreated, Id, Message"In wevtutil qe, /lf:true tells the tool the target is a standalone .evtx file rather than a live channel, /c:1 limits output to one event, and /rd:true reads newest events first. Pivoting with ProcessGuid in Get-WinEvent immediately surfaces every DNS query (ID 22) and network socket (ID 3) opened by that exact powershell.exe instance, even if PID 4812 was later reused by another application.
#Defending and common mistakes
- Forward logs off-host immediately: configure Windows Event Forwarding (WEF) or a SIEM agent so clearing local logs (
1102) or stopping Sysmon (Sysmon Event ID 4/System 7036) triggers an immediate alert and preserves prior events centrally. - Size channels properly: default
.evtxlimits (often 20 MB) wrap within hours on busy hosts. Increase retention withwevtutil sl "Microsoft-Windows-Sysmon/Operational" /ms:1073741824(1 GiB) where disk space allows. - Common mistake - deploying Sysmon without an XML filter: capturing every
ImageLoad(ID7) andFileCreate(ID11) floods storage and hides real alerts under millions of OS updates. Conversely, excluding entireC:\Users\paths blinds detections for user-writable drops. - Common mistake - correlating by
ProcessIdinstead ofProcessGuid: PID reuse across hours of logs links benign system processes to earlier malicious activity. - Common mistake - leaving
4688command-line auditing disabled: without the command-line GPO enabled, nativeSecuritylogs showpowershell.exeran, but not what arguments it received.
#Summary
- Native Windows auditing (
4624,4672,4688,4697/7045,1102) records authentication, privilege assignment, service creation and log clearing when Advanced Audit Policy and command-line logging are enabled. - Sysmon adds deep telemetry (process hashes, parent-child ancestry, network sockets, DNS lookups, registry writes and thread injection) tied together by a unique
ProcessGuid. - Analysts query live channels and offline
.evtxfiles withwevtutil(/lf:true,/q:) andGet-WinEvent(-FilterXPath,-FilterHashtable). - Resilient detection requires curated Sysmon XML filtering, sufficient log retention sizes and off-host forwarding to survive local log tampering.