Use it when traces look impossible or backends reject data for timestamps.
Clock Skew and Timestamps
Clock skew between hosts makes telemetry timestamps disagree: spans with negative durations, logs out of order, rejected samples (out-of-order/too old).
1. Offset: chronyc tracking / timedatectl.
2. Metric: node_timex_offset_seconds.
3. Backend errors: out of order / too far in past.
4. Fix NTP sources.
5. Alert on offset > 100 ms.
host clock → timestamp on telemetry → backend ordering/validation
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 How to verify Verify boundary
Alert on time offset from NTP above a small threshold. Check virtual machines after host migration or suspend.
Step 2 Common failures Narrow the fault
Containers use the host clock, so fix it on the node. Devices without NTP send logs with factory default dates. Mixing local time and UTC in log formats confuses correlation.
Run NTP/chrony everywhere and alert on offset. Prefer backend-assigned ingest time only when source time is unreliable.
chronyc tracking— first check for this topiccurl -s localhost:9090/-/ready— Prometheus readycurl -s 'localhost:9090/api/v1/query?query=up'— scrape targets up/downpromtool check config prometheus.yml— config valid
ReferenceWhat it is1 section · depth on demand
How it works
Each signal carries timestamps from the producing host. Backends accept data only within a window around their own time. Skew of even seconds makes traces confusing.
ReferenceImportant terms & boundaries3 sections · depth on demand
Detecting and fixing skew
timedatectl status ; chronyc tracking ; chronyc sources -v
w32tm /query /status
abs(node_timex_offset_seconds) > 0.05 # Prometheus alert on NTP offset
Symptoms: logs out of order, spans with negative durations, "sample out of order"/"too far in the future" rejections in Prometheus/Loki. Keep all hosts on NTP (chrony) with a reliable source, and prefer timestamps assigned at the source in UTC.
In depth
How skew shows up
| Symptom | Cause |
|---|---|
| Child span starts before its parent; negative durations | Clock difference between the two hosts |
| Logs from two services in the wrong order | Producers' clocks differ, or ingestion time used instead of event time |
out of bounds / too old / too far in the future rejections | Backend ingestion window (Prometheus, Loki, Cortex/Mimir) |
TLS certificate is not yet valid | Clock behind |
Kerberos/AD KRB_AP_ERR_SKEW | More than 5 minutes difference (default tolerance) |
Checking synchronisation
chronyc tracking # "System time : 0.000012 seconds fast of NTP time", Leap status: Normal
chronyc sources -v # ^* = selected source; reach 377 = last 8 polls OK
timedatectl # System clock synchronized: yes
w32tm /query /status ; w32tm /query /source ; w32tm /stripchart /computer:dc01 /samples:3
abs(node_timex_offset_seconds) > 0.05 or node_timex_sync_status == 0
Design that keeps time consistent
- Every host, VM, network device and container node syncs to the same small set of internal NTP servers, which sync to trusted upstream sources.
- Containers share the node's kernel clock; fix time on the node, not in the container.
- VMs: let the guest's NTP client (chrony or the Windows Time service) discipline the clock and disable conflicting hypervisor time sync for domain controllers per vendor guidance; check clocks after live migration, snapshot restore and suspend.
- Network devices:
ntp server,clock timezone, andservice timestamps log datetime msecso syslog carries precise times.
Event time vs ingestion time
Telemetry should carry the time the event happened, set by the producer; collectors should keep that timestamp and only fall back to receive time when none exists. Storing ingestion time hides skew and reorders events during backlog replay.
Common mistakes
- Unsynchronised clocks breaking correlation.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.