Windows audit policy and Sysmon: a logging baseline
Configure advanced audit policy subcategories, command-line capture, log sizes, Sysmon and Windows Event Forwarding so Windows logs can answer who, what, where and when.
When something goes wrong on a Windows network, the first questions are always the same: which account logged on where, what ran, what changed, and where did it connect? With default settings, Windows answers few of them. Process creation isn't logged, command lines aren't captured, the Security log wraps within hours on a busy server, and nothing leaves the host.
This guide builds a logging baseline in four layers: advanced audit policy, a few extra settings, Sysmon, and forwarding.
Layer 1: advanced audit policy
First, make advanced audit policy authoritative. Under Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options, enable Audit: Force audit policy subcategory settings (Windows Vista or later) to override audit policy category settings.
Then configure subcategories under Security Settings > Advanced Audit Policy Configuration > Audit Policies. A solid starting point, broadly aligned with Microsoft's baseline recommendations:
| Category | Subcategory | Setting | Key events |
|---|---|---|---|
| Account Logon | Credential Validation | Success, Failure | 4776 (NTLM validation) |
| Account Logon | Kerberos Authentication Service | Success, Failure (DCs) | 4768, 4771 |
| Account Logon | Kerberos Service Ticket Operations | Success, Failure (DCs) | 4769 |
| Account Management | Security Group Management | Success | 4728, 4732, 4756 (member added) |
| Account Management | User Account Management | Success, Failure | 4720, 4722, 4724, 4738, 4740 |
| Account Management | Computer Account Management | Success (DCs) | 4741, 4742 |
| Detailed Tracking | Process Creation | Success | 4688 |
| Detailed Tracking | PNP Activity | Success | 6416 (new device) |
| DS Access | Directory Service Changes | Success (DCs) | 5136, 5137 |
| DS Access | Directory Service Access | Success, Failure (DCs) | 4662 (with SACLs) |
| Logon/Logoff | Logon | Success, Failure | 4624, 4625 |
| Logon/Logoff | Special Logon | Success | 4672 (admin-equivalent logon) |
| Logon/Logoff | Account Lockout | Failure | 4625 (status 0xC0000234) |
| Logon/Logoff | Other Logon/Logoff Events | Success, Failure | 4778, 4779 (RDP reconnect/disconnect) |
| Object Access | Other Object Access Events | Success, Failure | 4698-4702 (scheduled tasks) |
| Object Access | Removable Storage | Success, Failure | 4663 on removable media |
| Policy Change | Audit Policy Change | Success | 4719 |
| Policy Change | Authentication Policy Change | Success | 4706, 4713, 4739 |
| Policy Change | MPSSVC Rule-Level Policy Change | Success | 4946-4950 (firewall) |
| Privilege Use | Sensitive Privilege Use | Success, Failure | 4673, 4674 (noisy; consider failures only) |
| System | Security System Extension | Success | 4697 (service installed) |
| System | Security State Change | Success | 4608, 4616 |
| System | System Integrity | Success, Failure | 4612, 5038 |
Check the effective policy on a host:
auditpol /get /category:*
auditpol /get /subcategory:"Process Creation"For a lab, you can set individual subcategories directly (GPO remains the source of truth in production):
auditpol /set /subcategory:"Process Creation" /success:enableLayer 2: the settings that make events useful
| Setting | Path | Why |
|---|---|---|
| Include command line in process creation events | Administrative Templates > System > Audit Process Creation | Adds the full command line to 4688. Without it you see powershell.exe, not what it ran. |
| PowerShell script block and module logging | See the PowerShell guide | Events 4104, 4103 |
| Security log maximum size | Administrative Templates > Windows Components > Event Log Service > Security > Specify the maximum log file size | 1 GB+ on servers, several GB on DCs |
| System and Application log sizes | Same location | 128 MB or more |
| Retain old events / backup log automatically | Leave off unless you manage the disk space | Otherwise the log stops or fills the disk |
Command lines can contain secrets (passwords passed as parameters). That is a reason to restrict who reads the logs and to fix those scripts, not to leave command-line logging off.
Also watch for evidence destruction: 1102 (Security log cleared) and 104 (another log cleared, in System) should always alert.
Layer 3: Sysmon
Sysmon (System Monitor, from Microsoft Sysinternals) is a free driver and service that records detailed process, network, file and registry activity to Applications and Services Logs > Microsoft > Windows > Sysmon > Operational. Since 2026 it is also a built-in optional feature of Windows 11 and Windows Server 2025, off by default and configured with the same XML; the Sysmon deployment guide covers choosing between the two. Its most useful events:
| ID | Event | Use |
|---|---|---|
| 1 | Process creation (with hashes, parent command line) | Execution chains |
| 3 | Network connection | Which process talked to which IP/port |
| 7 | Image loaded | DLL side-loading (filter heavily) |
| 8 | CreateRemoteThread | Process injection |
| 10 | Process access | LSASS access attempts |
| 11 | File created | Payload drops, dump files |
| 12 / 13 / 14 | Registry create/delete, value set, rename | Persistence keys |
| 22 | DNS query | Which process resolved which domain |
| 23 / 26 | File delete (archived / logged) | Tool clean-up |
| 25 | Process tampering | Process hollowing / herpaderping |
Sysmon is only as good as its configuration: an empty config logs very little, a naive one floods your SIEM. Start from a maintained community configuration, such as the SwiftOnSecurity sysmon-config or Olaf Hartong's sysmon-modular, then tune for your environment.
# Install with a configuration
Sysmon64.exe -accepteula -i sysmonconfig.xml
# Update the configuration later
Sysmon64.exe -c sysmonconfig.xml
# Show the active configuration
Sysmon64.exe -cDeploy Sysmon through your software distribution tool, pin the version, and monitor that the Sysmon64 service is running: stopping it is an obvious attacker move (Sysmon logs event 4 for service state changes and 16 for configuration changes).
Layer 4: get the events off the host
Local logs can be cleared by anyone with admin rights. Forward them.
Windows Event Forwarding (WEF) is built in and needs no agent:
- On a collector server:
wecutil qcto configure the Windows Event Collector service. - Create source-initiated subscriptions (XPath queries selecting the event IDs above).
- By GPO on sources: Administrative Templates > Windows Components > Event Forwarding > Configure target Subscription Manager =
Server=http://wec01.corp.example:5985/wsman/SubscriptionManager/WEC,Refresh=60. - Grant the Network Service account read access to the Security log on sources, by adding it to the Event Log Readers group through Restricted Groups or Group Policy Preferences.
From the collector, ship ForwardedEvents to your SIEM. If you already run a SIEM or EDR agent, point it at the same event IDs instead; the important thing is that events leave the host within minutes.
What good looks like
A quick way to test the baseline is to ask the questions from an imaginary incident and see whether your logs answer them:
- Who logged on to server X last Tuesday, from where? 4624 with logon type and source IP, forwarded.
- What did that session run? 4688 with command lines, Sysmon 1, PowerShell 4104.
- Did anything touch LSASS? Sysmon 10 filtered on
lsass.exe. - Was persistence added? 4697 / 7045 (service), 4698 (scheduled task), Sysmon 13 on Run keys.
- Where did it connect? Sysmon 3 and 22.
- Did someone try to hide it? 1102, 104, Sysmon 4/16, Defender 5001/5007.
Checklist
- Advanced audit policy forced to override; subcategories set as above
- Command-line capture in 4688 enabled
- Security log sized for days, not hours; clear-log events alerted
- Sysmon deployed with a maintained, tuned configuration
- Events forwarded (WEF or agent) and retained centrally
- Incident questions answered end-to-end in a tabletop test
Logging doesn't prevent anything, but every other control on this map is easier to trust when you can see it working, and see the moment it stops.
Frequently asked questions
Do I need Sysmon if I have an EDR?
Not strictly: most EDRs collect similar telemetry. Sysmon is still valuable where no EDR is deployed, as an independent source during investigations, or to feed your own SIEM with process, network and DNS events at no licence cost.
How large should the Security log be?
Large enough to hold at least several days locally even if forwarding breaks. On workstations 256 MB to 1 GB is common; on domain controllers and busy servers, several GB. Forward events centrally so local size is a buffer, not your retention.
Why use advanced audit policy instead of the basic audit policy?
The nine basic categories are too coarse: enabling one turns on noisy subcategories you don't need. Advanced audit policy has about sixty subcategories, so you collect what matters without drowning. Force it to take precedence so the two don't conflict.
Windows audit policy and Sysmon: a logging baseline