Event Logging
Cheat sheet · https://pcornel.dk/topic.php?topic=3126
Answer
Windows Event Logging records structured events from Windows components, services, applications and security auditing. The useful unit is not merely an Event ID: provider, channel, level, timestamp, task/opcode, keywords and event data give the event its meaning.
Remember
- Treat provider + channel + Event ID + timestamp/context as one evidence tuple.
- An event proves that a provider reported an observation; it does not automatically prove root cause.
- Absence of an event can be weak evidence if auditing, channel enablement, retention or collection scope is unknown.
- Operational/Admin channels often contain more component-specific detail than the classic Application/System logs.
- Correlate logs with runtime state, configuration and the exact symptom before concluding causation.
First checks
Get-WinEvent -LogName System -MaxEvents 50— recent System eventsGet-WinEvent -FilterHashtable @{LogName='Application';Level=2;StartTime=(Get-Date).AddHours(-1)}— errors last hourGet-WinEvent -ListLog * | ? RecordCount— logs with entrieswevtutil gl <log>— log size and retention
Commands
wevtutil- Windows command-line utility for enumerating event logs/providers, reading log configuration, querying/exporting events…
Get-WinEvent- PowerShell cmdlet for querying Windows Event Log and ETW-style event sources as structured EventLogRecord objects, with…
Get-WinEvent -FilterHashtable @{LogName="System"; Id=<id>}- Query Windows event logs.
Get-WinEvent -FilterHashtable @{LogName='System'; StartTime=(Get-Date).AddHours(-1)}- Structured Windows Event Log query.
Get-WinEvent -FilterHashtable @{LogName="System"; StartTime=(Get-Date).AddHours(-1)}- Reads recent structured Windows event log entries.
Verify in this order
event raised by a provider → written to a channel/log → retained per size policy → read or forwarded
Where it usually breaks
First mismatch in definition/configuration → security context → service/task/process creation → runtime state → output/side effect → event/performance evidence; preserve identity/native error/pre-state before mutation.
Event Logging reference map
| Boundary | Meaning | Evidence limit |
|---|---|---|
| Channel | Container/subscription for events | channel presence does not prove useful auditing |
| Provider | Component that emits an event | provider name does not prove root cause |
| Event ID | Provider-defined event identifier | ID alone is ambiguous |
| Payload | Structured event-specific data | payload may describe symptom rather than cause |
| Correlation | Time/context relationship across evidence | correlation is not causation |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3126