NTP synchronisation not visible in syslog
Solution 1:
NTP is normally very quiet/silent in syslog. Things are going wrong if it shows up. If your hardware clock is working, it shouldn't need to modify your clock during startup. With the right settings it can replace ntpdate to set the clock on startup if required.
The logs you want to look at are the loopstats
and peerstats
files. Once running NTP should not need to synchronize the clock. It will adjust the tick timing very slightly to keep the clock synchronized. loopstats
file provides your local state, while peerstats
shows your state relative to the servers you are using. See the NTP Troubleshooting Guide for details on these files.
Solution 2:
Just for confirming that the system is synchronized the following can be executed:
# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
159.69.144.253 94.16.116.137 3 u 60 64 37 2.749 -2.464 0.066
*176.9.241.107 192.53.103.108 2 u 61 64 37 0.461 0.237 0.026
193.175.73.20 .MRS. 1 u 62 64 37 19.189 1.786 0.072
138.68.126.106 130.149.17.8 2 u 59 64 37 5.366 0.562 0.043
Where an *
suffix for a record indicates that that peer is currently being used for synchronization.
In the other hand, for detailed monitoring/logging of clock synchronization events, I found the following to be quite helpful:
First, create the following folder if it doesn't exist and assign it ownership to the user running the NTP daemon:
# mkdir /var/NTP/
# chown ntp /var/NTP/
Now modify ntp.conf
like this where the meaning of each one of these entries is explained in http://doc.ntp.org/4.2.6p3/monopt.html:
statsdir /var/NTP/
filegen clockstats file clockstats
filegen cryptostats file cryptostats
filegen loopstats file loopstats
filegen peerstats file peerstats
filegen protostats file protostats
filegen rawstats file rawstats
filegen sysstats file sysstat
filegen timingstats file timingstats
Then restart the NTP service and look at the /var/NTP/
folder.
Finally, for example, to determine the peers that has been used for synchronization as time goes, look for lines ending in sys_peer
in /var/NTP/protostats
, e.g.:
58827 80454.306 159.69.144.253 8014 84 reachable
58827 80647.304 176.9.241.107 901a 8a sys_peer
58827 80647.304 0.0.0.0 c615 05 clock_sync
58827 80842.323 193.175.73.20 901a 8a sys_peer
PS:
- I'm not a NTP expert, so I could be wrong in some of the previous statements.