IT & Systems Administration · Fundamentals
Triage Windows Event Logs after an unexpected failure
A server restarted overnight and Event Viewer now holds tens of thousands of entries. This guide gives you a repeatable way to go from "something happened" to an explanation you can defend. AI does the sorting. The diagnosis stays with you.
What AI is for here, and what it isn't
Event logs are a volume problem. A single bad night can produce thousands of entries, most of them routine. AI is useful for collapsing that volume, putting events in order and explaining unfamiliar providers. It is unreliable at knowing which machine matters, what changed last Tuesday, or whether a warning is normal in your environment. You know those things, so you stay in charge of the investigation.
Define the question before opening a log
A model will find patterns in whatever you give it, including patterns that have nothing to do with the problem. Write down three things first.
- The symptom, in one sentence, as it was reported. "SQL-PRD-02 stopped responding at about 02:05 and was back by 02:12. No maintenance was scheduled."
- The time window. Start 20–30 minutes before the first report and end after recovery. A wider window mostly adds noise.
- What changed. Patches, driver or firmware updates, backup jobs, Group Policy edits, hardware work. If you don't know, check Windows Update history and your change log before going further.
These three lines become the context block of your prompt in Step 5.
Export only what matters
Run this in a PowerShell session on the affected machine. It collects Critical, Error and Warning events from the System and Application logs in your window, which includes Kernel-Power 41, EventLog 6008 and BugCheck 1001. It also picks up a few informational events that mark restarts and updates, queried per provider because event IDs aren't unique across providers. Those markers are the ones people miss: 1074 (a restart was requested, and by whom) and 6005 (the log service started at boot) are logged as Information, not Error.
# Example from AI Field Manual. Provided as-is, without warranty.
# Read it, then test it in a non-production environment before any production use.
# Set the window: ~30 min before the first report through recovery
$start = Get-Date '2026-11-17 01:40'
$end = Get-Date '2026-11-17 02:40'
# 1. Everything Critical, Error or Warning in the window
$problems = Get-WinEvent -FilterHashtable @{
LogName = 'System', 'Application'
Level = 1, 2, 3
StartTime = $start; EndTime = $end
} -ErrorAction SilentlyContinue
# 2. Informational restart and update markers, one query per provider
$markerQueries = @(
@{ ProviderName = 'User32'; Id = 1074 } # restart or shutdown requested
@{ ProviderName = 'EventLog'; Id = 6005, 6006, 6009 } # log started / stopped / boot info
@{ ProviderName = 'Microsoft-Windows-WindowsUpdateClient'; Id = 19, 43 } # update installed / started
)
$markers = foreach ($q in $markerQueries) {
Get-WinEvent -FilterHashtable (@{ LogName = 'System'; StartTime = $start; EndTime = $end } + $q) -ErrorAction SilentlyContinue
}
$events = @($problems) + @($markers) | Where-Object { $_ } |
Sort-Object TimeCreated, LogName, RecordId -Unique
if (-not $events) { Write-Warning 'No events returned. Check the window, the time zone and your access to the logs before concluding nothing happened.' }
$events |
Select-Object TimeCreated, LogName, ProviderName, Id, LevelDisplayName,
@{ n = 'Message'; e = { ($_.Message -split "`r?`n")[0] } } |
Export-Csv "$env:USERPROFILE\Desktop\events-window.csv" -NoTypeInformation -Encoding UTF8
"{0} events exported" -f $events.Count
You usually don't need administrator rights to read the System and Application logs, though access depends on each log's permissions and your organization's policy. The Security log is more restricted. Add 'Security' to LogName only when the symptom involves sign-ins or lockouts, and filter it tightly. To query a remote machine, add -ComputerName to each Get-WinEvent call.
Summarize locally before you send anything
Pasting four thousand raw rows into a chat wastes context, and the model will tend to treat the most frequent event as the most important. Collapse repeats first so each distinct event appears once, with a count and the times it first and last occurred. Run this in the same session. It writes the summary to a local file rather than the clipboard, because clipboard history and sync features can keep a copy of unredacted text.
# Example from AI Field Manual. Provided as-is, without warranty.
# Read it, then test it in a non-production environment before any production use.
$summaryPath = "$env:USERPROFILE\Desktop\events-summary.txt"
$events |
Group-Object LogName, ProviderName, Id |
ForEach-Object {
$sorted = $_.Group | Sort-Object TimeCreated
$first = $sorted | Select-Object -First 1
$last = $sorted | Select-Object -Last 1
[pscustomobject]@{
Count = $_.Count
FirstAt = $first.TimeCreated.ToString('yyyy-MM-dd HH:mm:ss')
LastAt = $last.TimeCreated.ToString('yyyy-MM-dd HH:mm:ss')
Log = $first.LogName
Provider = $first.ProviderName
Id = $first.Id
Level = $first.LevelDisplayName
Message = ($first.Message -split "`r?`n")[0]
}
} |
Sort-Object FirstAt |
Format-Table -AutoSize | Out-String -Width 400 |
Out-File $summaryPath -Encoding UTF8
# events-window.csv stays on this machine as your raw record.
# Redact events-summary.txt in Step 4 before any of it goes into an AI tool.
Sorting by first occurrence, not by count, gives you a rough timeline before AI is involved, and the last-occurrence column shows whether an event was a single burst or kept recurring. The output is usually under sixty lines. Grouping hides variations in message text, so keep the CSV from Step 2 to check details later.
Redact identifiers
Replace anything that identifies your environment with consistent tokens. Consistency matters: if SQL-PRD-02 always becomes NAME_1, the model can still follow which events belong to which machine. Keep the token key on your side so you can translate the answer back.
Open events-summary.txt, paste its contents into the redactor below, and review the output. The redactor runs only in this page. If Windows clipboard history (Win+V) or clipboard sync is turned on, clear it afterward.
Token key Keep this on your machine
No tokens yet.
Pattern matching can't catch everything. Version strings can look like IP addresses, and unusual hostnames will be missed unless you list them. Read the output before you send it.
Ask for evidence, not answers
The prompt below asks the model for a timeline, competing hypotheses, the evidence that would disprove each one, and a next check for each. That keeps it from settling on one confident story.
Edit the fields and the prompt updates as you type.
What a useful answer looks like
Run against a summary like the one in this example (a storage fault that took down a SQL Server host), a good response reads something like the excerpt below: specific, cited, and open about what it can't tell.
Timeline
- stornvme 129 — first storage controller reset; 37 follow
- disk 153 — I/O retried on Disk 1 (22 occurrences)
- Application Error 1000 — sqlservr.exe faults
- SCM 7031 — SQL Server service terminates unexpectedly
- Kernel-Power 41 / EventLog 6008 — both recorded at the next boot; 6008 puts the last clean timestamp at 02:08:51. No 1074 in the window, so no restart request was logged (on its own, that doesn't prove nobody initiated one)
Hypothesis 1 — storage path failure on Disk 1
Supported by 129 → 153 → SQL fault, in that order. Contradicted if 129/153 also appear regularly on nights without an outage. Next check: compare the storage driver and firmware versions with the 2026-11-14 update, and read the hardware event log on the management controller.
Likely noise
DistributedCOM 10016 (148×) is a common permissions warning, usually unrelated. NETLOGON 5719 after boot is expected while the network stack initializes.
Verify before you trust
Models sometimes cite event IDs that aren't in your data, or describe a real ID with confidence and get it wrong. Check every ID against your export and against a short reference like this one. Remember that 41 and 6008 are written when the machine boots again, not at the moment it failed.
| ID | Log · Source | Meaning | Triage note |
|---|---|---|---|
| 41 | System · Kernel-Power | System rebooted without cleanly shutting down | Tells you that it went down hard, not why. Look at what came just before. |
| 6008 | System · EventLog | Previous shutdown was unexpected | Logged at the next boot; the message holds the last known time. |
| 1074 | System · User32 | A process or user initiated a restart or shutdown | Names the process, account and reason. If present, the restart was requested. |
| 6005 · 6006 | System · EventLog | Event log service started · stopped | Boot and clean-shutdown markers. Use them to bracket your timeline. |
| 7031 · 7034 | System · Service Control Manager | Service terminated unexpectedly | A symptom. Look for the matching Application Error 1000 for the faulting module. |
| 7000 · 7009 | System · Service Control Manager | Service failed to start · start timed out | Common after updates or when a dependency isn't running yet. |
| 1000 | Application · Application Error | Application crashed | Faulting module and exception code are the useful parts. |
| 129 · 153 | System · storage driver · disk | Reset issued to device · I/O operation retried | Storage path trouble. Check firmware, driver, cabling and controller health. |
| 19 · 20 · 43 | System · WindowsUpdateClient | Install succeeded · failed · started | Establishes what changed, and when. |
| 5719 | System · NETLOGON | Couldn't set up a secure session with a domain controller | Often transient at boot. Worth attention only if it continues. |
| 10016 | System · DistributedCOM | Application-specific permission settings warning | Usually benign background noise. Don't let it lead the investigation. |
Before you act on any AI answer
0 of 5
Act, then write it down
Translate the tokens back using your key, make the change you've decided on, and record what you found. The next person to see this failure, which may be you in six months, needs to know what was checked and who checked it.
Symptom: [one sentence, as reported]
Window reviewed: [start] – [end] [time zone]
System + Application, Critical/Error/Warning + restart markers
Timeline (from event log):
[time] [provider] [id] [what it shows]
[time] [provider] [id] [what it shows]
Most likely cause: [hypothesis]
Supported by: [event IDs]
Confirmed by: [check you ran, outside the AI]
Confidence: [low / medium / high]
Ruled out: [what, and how]
Action taken: [change] Rollback: [how]
Follow-up: [monitoring, vendor case, scheduled review]
AI assistance: event summary was redacted and analyzed with [tool].
Conclusions verified by [name] on [date].
The last line is there on purpose. It records which parts were machine-drafted and who took responsibility for the conclusion.
What stays with you
- Deciding which hypothesis is true
- Any change to a production system
- What you tell users and leadership
- Judging whether it will happen again