Lesson 2.63: Time sync and time zones
Logs from different machines only line up if every clock is right and every timestamp says which time zone it's in. A server whose clock drifts, or which writes local time while the others write UTC, makes an investigation lie: events appear in the wrong order or minutes apart. On Ubuntu, systemd-timesyncd keeps the clock in step with a time server, and timedatectl shows and sets both the synchronisation and the time zone. In the lab one SSH login shows up four minutes and three hours apart in two logs; you find out why, turn synchronisation back on and move the server to UTC.
15 min
You will learn to
- Explain why clock drift and time zones break log correlation
- Read timedatectl output
- Find the configured time server
- Turn on NTP synchronisation and check it
- Set servers to UTC
Key terms
- NTP
- Network Time Protocol: a client asks time servers and adjusts its clock.
- systemd-timesyncd
- Ubuntu's built-in simple NTP client; chrony is the full-featured alternative.
- Clock drift / offset
- How far the local clock is from the real time.
- UTC
- Coordinated Universal Time: one time for the whole world, no daylight saving.
- UTC offset
- The +03:00 or Z at the end of a timestamp: how it relates to UTC.
← Looking at text files: cat, less and more · All lessons · Containers are processes: namespaces →