Incident Reconstruction Fails When Logs Lack Time Zone Offsets and Proper Synchronization

Reconstructing security incidents from multiple log sources often collapses when timestamps lack time zone information or consistent synchronization. Events from web servers, load balancers, applications, and mail gateways can appear in physically impossible order, such as responses preceding requests or sessions closing before they open. The root causes include clock drift without NTP, mismatched reference points like UTC versus local time, and timestamps recorded at message processing rather than event occurrence. Classic BSD syslog (RFC 3164) omits both year and offset, forcing investigators to consult potentially unavailable source systems. Modern RFC 5424 provides full timestamps with offsets, making normalization possible without external context. Organizations must enforce offset-inclusive formats at ingestion, monitor actual synchronization status rather than service uptime, and document external sources whose timestamps cannot be controlled.

HabrTranslated from Russian

Read at source

Reconstructing a security incident from four separate log sources — web server, load balancer, application, and mail gateway — should be straightforward mechanical work: collect events, sort them chronologically, and trace the sequence. Yet the timeline can quickly become impossible when responses appear before requests, sessions close before they open, or emails arrive two hours before they were sent, all without any obvious parsing error.

Three distinct timing problems explain these contradictions. Clock drift occurs when unsynchronized systems lose or gain seconds per day, enough to invert closely spaced events after weeks or months. Different reference points arise when one host logs in UTC, another in local time, and a third in whatever zone the container was configured with. Recording at ingestion rather than at the moment of the event introduces variable delays when buffering or retransmission is involved.

The classic syslog format defined in RFC 3164 compounds the difficulty: lines contain neither year nor time-zone offset. Year can sometimes be recovered from file rotation, but the offset cannot. The newer RFC 5424 format solves this by embedding a complete timestamp with offset and fractional seconds, allowing normalization without consulting the originating host.

Standardizing on UTC helps only for systems under direct control. Headers from external mail servers, logs from third-party providers, and exports from SaaS consoles all carry their own offsets. The only reliable moment to capture the correct offset is at ingestion, when the source is still known.

Even running an NTP client does not guarantee synchronization. The systemd-timesyncd service may report as active while repeatedly failing to reach its time server, leaving the clock free-running. Operators must check the NTPSynchronized flag and actual offset metrics rather than service status alone. Virtual machines add further complications: after suspend and resume, guest clocks can jump discontinuously, creating minutes that never existed or duplicate intervals in the logs.

Two kernel clocks are frequently confused in application code. CLOCK_REALTIME reflects wall-clock time and is adjusted by NTP; it is the correct source for log timestamps. CLOCK_MONOTONIC measures elapsed time since boot and never jumps backward, but its values cannot be correlated across hosts or with external events.

Preventive measures include mandating RFC 5424 or ISO 8601 with offset and sub-second precision in logging requirements, normalizing timestamps on arrival while preserving originals, monitoring synchronization drift as a metric, and maintaining a short reference document describing the timestamp semantics of every external source.

Meridian digestThe week's most consequential security stories, distilled into one briefing.See the digest

More in Other

Mail.ru Reduces Lifetime 1TB Cloud Storage Promo to Standard 8GB Quota for Select Users
Kimi K3 Open Model Surpasses Closed AI Leaders with Million-Token Context and 896 Experts
Innostage Completes Functional Testing of PT NGFW 1.10.3 Across 156 Criteria