EVTX Event Log Viewer
Operator: Abdulla Al Fahad. How tools are built and checked
Someone sends a Security.evtx from a server you cannot log in to and asks what happened on Tuesday night. Event Viewer needs Windows and the right permissions, and a copied log is often marked dirty or half overwritten. This viewer reads the file directly: it walks the 64 KB chunks, checks their checksums, decodes the binary XML of every record, and lets you filter the result by event id, level, provider, computer, time and any text in the event data.
Key features
- File header, per-chunk header CRC and record-data CRC checks, with the chunks that fail listed with their record id ranges
- Every record decoded from Binary XML, including template instances and substitution arrays, and shown as a table row and as rebuilt XML
- Slack-space recovery: records left after a chunk's free-space offset, or in a chunk with a damaged header, are found by signature and marked recovered
- Filters for event ids and ranges, level, provider, computer, UTC time range and EventData text, a timeline of matches, and ready views for 4624 and 4625 logons, 4688, 4720, 7045 and 1102
- CSV and JSON export of the filtered records, with spreadsheet formulas neutralised in the CSV
How chunks, records and binary XML are decoded
An .evtx file starts with a 4,096-byte header (signature ElfFile, the next record id, a flags field whose bit 0 means the file was dirty when copied) followed by 64 KB chunks. Each chunk has a 512-byte header (signature ElfChnk, first and last record ids, the offset where free space begins, and two CRC-32 values) and then records. A record is the bytes 2A 2A 00 00, its size, a record id, a FILETIME, a Binary XML body and the size again.
Binary XML stores element and attribute names once per chunk and refers back to them by offset. Windows events are written as a template instance: a definition holding the shape of the Event element with numbered holes, followed by an array of values (strings, integers, FILETIMEs, GUIDs, SIDs, hex values, or a nested Binary XML fragment) that fill them. The viewer caches each definition per chunk and fills it for every record.
How it works
A record is accepted only when its signature matches, its size fits the chunk and the size copy at its end equals the size at its start. After the normal walk to the free-space offset, any non-zero bytes left in the chunk are scanned on 8-byte boundaries for the same signature with a plausible record id and a timestamp between 1995 and a year ahead, which keeps random bytes from being reported as events.
Event fields come from the System element (provider, id, level, task, opcode, keywords, time, record id, process and thread ids, channel, computer, security id) and from EventData, or from the first element inside UserData.
When this helps
- A responder filters event id 4625 and sees 3 failures in 4 seconds from one address, then a 4624 with logon type 10 from the same address two minutes later: a brute-forced remote desktop logon.
- A sysadmin opens the 7045 view and finds a service named BackupSync with an image path under C:\Temp, installed minutes after a new account appeared in the 4720 view.
- An analyst receives a log in which the chunk table marks chunk 14 as failing its records CRC, with record ids 8,401 to 8,460. She treats that id range, and the minutes of the timeline it covers, as incomplete evidence, and asks the server owner for a clean copy before drawing conclusions about activity in it.
- An auditor exports the 1102 view to show who cleared the Security log and when, with the account and domain from the event itself.
Opening a file
- Drop an .evtx file, or open the small built-in log to see the views first.
- Pick a view such as Logons, or type event ids like 4625, 4740 or 4688-4690.
- Click a record number to see its EventData and rebuilt XML, then export the rows as CSV or JSON.
Example
The built-in example-security.evtx, 69,632 bytes: one chunk, ten events and one stale record
View: Logons 4624 / 4625, with Carve records from slack space onRows and chunk notes
7 rows: 4 successful logons (alice type 3 from 10.0.0.15, administrator type 10 from 203.0.113.50, alice type 2, and carol type 2 recovered) and 3 failures for administrator from 203.0.113.50 at 08:01:30, 08:01:32 and 08:01:34
Chunk 0: header CRC ok, records CRC ok, 1 record carved from slack space
Other views: 4688 1 row, 4720 1 row, 7045 1 row, 1102 1 rowTips for best results
- Read the first and last times printed under the timeline, then narrow From and To (both in UTC) around the burst you see.
- Text in EventData searches both names and values, so entering a hostname or IP address matches 4624 source fields and 4688 command lines alike.
- Record ids can jump when the log wrapped or a chunk is damaged; a gap in ids inside one chunk is worth a look, a gap between chunks is normal for a rolled log.
- Turn on Recovered records only to see just the old events the live log no longer lists.
Limits
A recovered record is a fragment of an older pass of the log, kept only when its record id is not already held by a live record. Its time and content can be real history or partially overwritten, so cite it as carved, not as a current event.
Message text is not in the file. Event Viewer renders descriptions from DLLs on the machine that wrote the log, so this page shows raw EventData names and values.
Only the .evtx format is read, not the older .evt, and not files from Event Tracing for Windows (.etl).
Common errors and how to fix them
- Not an EVTX file: the first 8 bytes are not "ElfFile"
- The file is not an event log in the Windows Vista format. Older .evt files and .etl traces need other tools; a file renamed by a mail gateway may have to be re-downloaded.
- The header says 26 chunks but the file holds 33
- The log was copied while Windows was writing it, so the header counts are stale. The page reads the chunks that are actually present and flags the file as dirty.
- Reading stopped at 600,000 records
- The file holds more events than this page keeps. Export the same time range with wevtutil first, or split the log by time on the source machine.
Best practices
- Export the filtered rows to CSV before you close the tab, and keep the original .evtx next to it as the evidence.
Checks and limits
The header CRC covers the first 120 bytes of the file and the chunk header CRC covers bytes 0 to 119 and 128 to 511 of the chunk. The records CRC covers the chunk from byte 512 to its free-space offset. Template instances may nest at most 8 deep, a record may produce at most 20,000 XML nodes and 80,000 tokens, and a chunk may hold at most 4,000 template definitions. Files up to 768 MB and 600,000 records are read.
Security event ids the views cover
4624 and 4625 are successful and failed logons; the logon type separates an interactive sign-in (2) from a network one (3), a service (5), an unlock (7) and a remote desktop session (10). 4688 records a process starting, with the command line when that audit setting is on. 4720 is a user account created, 7045 a service installed (in the System log) and 1102 the audit log being cleared.
Which events exist depends on the audit policy of the machine that wrote the log, so a missing 4688 can mean process auditing was off, not that nothing ran.
Frequently asked questions
What does a real log look like in the page?
A public sample named security.evtx, 2.1 MB with 26 chunks, decodes to 2,261 records. In every chunk the number of decoded records equals the last record id minus the first plus one. With recovery on, the three extra records found in slack space repeat the ids of live records, so they are dropped and the count stays at 2,261.
Why does a copied log say dirty?
Windows sets a flag in the file header while the log is open for writing and clears it when the log is closed. A copy taken from a running machine usually carries the flag, and its header counts can lag the chunks that were already written.
Why are some Security events missing a user id?
Many audit events do not carry a UserID on the System element, and the page reports what the file contains. The account names are in EventData, for example SubjectUserName and TargetUserName.
Does recovery change the original numbers?
Normal records are decoded the same way with recovery on or off. Recovery only adds rows marked recovered, and only for record ids the live log does not already hold; a carved copy of a live record is dropped and counted in a warning, so the Records figure and the exports hold each id once. The line beneath the figure says how many recovered rows there are.