Skip to content

Build a UTC Incident Timeline From Windows and Linux Logs

Admin
November 20, 2026
5 min read
Intermediate
๐Ÿ’ป Target OS: Windows / Linux (PowerShell 7+, systemd, and Python 3.10+)

Before you begin

  • Applies to:Incident timelines assembled from Windows and Linux logs using Python 3.10 or later.
  • Where to start:Collect source events with PowerShell 7 or later on Windows and journalctl on Linux. Build the timeline on the analysis workstation.
  • What you need:Choose the UTC time range and note any known clock offsets before collecting events.
Guide tools
Guide tools
0/0 Steps (0%)

Downloads

Steps

01

Export the Windows System log

Use an account with read access to the selected channel. Preserve the source host and channel in your notes. If no records are returned, verify the collection window and retention before proceeding.

Terminal window
$Start = [DateTimeOffset]::Parse('2026-11-19T10:00:00Z').UtcDateTime
$End = [DateTimeOffset]::Parse('2026-11-19T11:00:00Z').UtcDateTime
Get-WinEvent -FilterHashtable @{ LogName = 'System'; StartTime = $Start; EndTime = $End } -ErrorAction Stop |
Select-Object @{Name = 'TimeCreatedUtc'; Expression = { $_.TimeCreated.ToUniversalTime().ToString('o') }},
@{Name = 'HostName'; Expression = { $_.MachineName }},
@{Name = 'Provider'; Expression = { $_.ProviderName }},
@{Name = 'EventId'; Expression = { $_.Id }}, Message |
Export-Csv -LiteralPath windows.csv -NoTypeInformation -Encoding utf8
02

Export the Linux journal

Use authorized journal access and the same UTC window. JSON mode writes one object per line. The journalโ€™s original realtime timestamp is in microseconds since the Unix epoch.

Terminal window
journalctl --since '2026-11-19 10:00:00 UTC' \
--until '2026-11-19 11:00:00 UTC' --output=json --no-pager > journal.jsonl
03

Merge and mark gaps

Use a UTF-8 environment. The script retains both original exported timestamps and source fields. It marks an interval with no rows in the supplied export for the same host and source. The script sorts in memory. Exit 2 indicates invalid or unreadable input.

Terminal window
python -X utf8 incident_timeline.py windows.csv journal.jsonl --gap-minutes 15 > timeline.csv
04

Validate against the raw exports

Verify

Check sample rows and exact source timestamps against the originals. Account for clock drift before inferring causation. A gap can come from filtering, retention, clock errors, or a quiet workload. Document collection scope and retain the raw evidence.

References

Comments