Build a UTC Incident Timeline From Windows and Linux Logs
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
Downloads
Steps
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.
$Start = [DateTimeOffset]::Parse('2026-11-19T10:00:00Z').UtcDateTime$End = [DateTimeOffset]::Parse('2026-11-19T11:00:00Z').UtcDateTimeGet-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 utf8Export 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.
journalctl --since '2026-11-19 10:00:00 UTC' \ --until '2026-11-19 11:00:00 UTC' --output=json --no-pager > journal.jsonlMerge 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.
python -X utf8 incident_timeline.py windows.csv journal.jsonl --gap-minutes 15 > timeline.csvValidate against the raw exports
VerifyCheck 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
Your feedback keeps these production procedures accurate and battle-tested.