Lesson 9 of 14 · 15m
Event Logs: Not Syslog, and That's the Point
Events are XML documents in per-component channels with named fields — the IDs that matter, wevtutil and Get-WinEvent, and why a cleared log is itself the alert.
Structured events, not line files
Windows Event Log is a publisher-subscriber system that emits XML documents — a System block (Provider, EventID, Level, Channel, Computer) plus an EventData payload — stored in binary .evtx files under C:\Windows\System32\winevt\Logs. There is no /var/log to tail, and "grep the log" is a category error: you query by XPath against a schema each channel owns.
The channel model is the second half of the mental model. The three classics — Application, Security, System — date to NT. Since Vista, everything componentized lives under "Applications and Services Logs": Microsoft-Windows-TaskScheduler/Operational, Microsoft-Windows-Sysmon/Operational, Windows PowerShell, Microsoft-Windows-Windows Defender/Operational, hundreds more. wevtutil el lists all of them — run it once on a server and the log landscape stops being a mystery. Two channel types sit disabled by default: Analytic and Debug, the verbose tracing channels that can write gigabytes — enable them for a repro, then turn them back off.
Every event carries a RecordID — a per-channel sequence number — which is what forwarding and SIEM checkpoints are built on. And the Security channel is special in two ways: it sits behind SeSecurityPrivilege ("Manage auditing and security log"), which is why your monitoring service account can't read it until you grant that right, and its object-access events need a SACL on the object plus audit policy — two switches, both required.
The anatomy of one event makes this concrete. A 4624 carries SubjectUserSid, TargetUserName, LogonType, IpAddress, AuthenticationPackageName, ProcessName — the fields are named in EventData/Data[@Name=...] elements, which is what the XPath queries filter on. Structured fields beat text: a parser never regexes "failed logon for user X" out of a sentence.
The IDs worth memorizing
- 4624 logon, with
LogonType: 2 interactive, 3 network, 5 service, 7 unlock, 10 RemoteInteractive (RDP), 11 cached - 4625 failed logon — same LogonType field, which is how you tell a brute force on RDP from a brute force on SMB
- 4648 explicit credentials (
runas), 4672 special privileges assigned - 4688 process created; 4689 exited
- 4698 / 4702 scheduled task created / updated
- 7045 (System channel) a service was installed
- 4720–4732 user and group lifecycle; 4740 lockout
- 4768–4776 Kerberos and NTLM authentication events
- 1102 — the Security log was cleared. The tamper marker itself.
- 4719 audit policy changed; 4663 object access; 5156/5157 Windows Filtering Platform allow/block
Tools: Event Viewer is the GUI — the filtered-view XML tab in the filter dialog is where you steal working XPaths from. wevtutil is the CLI: wevtutil qe Security /q:"*[System[(EventID=4625)]]" /f:text /c:20 queries, wevtutil epl Security C:\sec.evtx exports a channel, wevtutil gl Security and wevtutil sl Security /ms:1073741824 read and set channel properties like maximum size. In PowerShell:
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624; StartTime=(Get-Date).AddHours(-1)}
Get-WinEvent -FilterXml $xmlFilterHashtable covers the common case; FilterXml takes raw XPath when you need EventData field conditions — the hashtable can't express "LogonType=10":
$q = '<QueryList><Query Path="Security"><Select>*[System[(EventID=4624)] and EventData[Data[@Name="LogonType"]=10]]</Select></Query></QueryList>'
Get-WinEvent -FilterXml $q -MaxEvents 50Get-EventLog still exists but is the deprecated legacy API — it can't see the post-Vista channels at all. Use Get-WinEvent.
Levels run 1–5: Critical, Error, Warning, Information, Verbose. Retention is a per-channel policy: overwrite-as-needed (circular), archive (autoBackupEventFiles drops full .evtx files alongside), or do-not-overwrite — which stops logging entirely, a denial of your own visibility. The Security channel's default — ~20 MB historically, ~128 MB on current builds — still rolls fast on a busy box; raise it past a gigabyte or forward the events off.
One last mechanical truth: events are rendered through the provider's message file, so an .evtx exported to a box without the provider shows descriptions as unresolved. wevtutil al archives with the locale metadata embedded — use it before shipping files to a forensics box.
The real-world proof is how attackers behave: wevtutil cl Security — or Clear-EventLog — is in every cleanup playbook, which is why 1102 plus a log that suddenly goes quiet is treated as an incident, not housekeeping.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
BlueHammer: The Unpatched Windows Zero-Day That Weaponizes Microsoft Defender Against Your Own System
BlueHammer is an unpatched, publicly released Windows local privilege escalation exploit that chains Microsoft Defender's update workflow, Volume Shadow Copy, Cloud Files callbacks, and opportunistic locks to reach NT AUTHORITY\SYSTEM from a standard user account.
A Fake GTA 6 ISO Didn’t Install a Game. It Installed a Wiper.
A fake GTA 6 ISO used a believable installer error to cover remote-access malware, browser-data theft, and destructive file wiping. The “License not found” message wasn’t the crack failing. It was there so the victim would stop looking.
Running a Minecraft Network: Four JVMs, One Box, and the Settings That Lie to You
Four servers on one host means four JVMs each sizing its thread pools for a machine it does not own. The measured cost of that, the systemd ordering that guarantees nothing, and the throttle that switches itself back on when your forwarding breaks.
Building a Minecraft Network: Four Servers Pretending to Be One Place
A proxy, a lobby, an SMP and a PvP arena is four JVMs that know nothing about each other. What actually has to be shared, why your permissions don't follow players, and the two LuckPerms defaults that silently share nothing at all.