How set ntpd log to DEBUG or something more verbose

I have Ubuntu Server 18.04 and configured time synchronization with my Windows Domain controller through ntpd. My config file, /etc/ntp.conf, contains:

driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntpd.log
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 1.2.5.6 iburst burst minpoll 6 maxpoll 8
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery

ntpd starts and I think it works fine. Here's an example ntpq -pn command output:

 remote refid st t when poll reach delay offset jitter
==============================================================================
*1.2.5.6 1.2.5.3 4 u 53 64 3 0.591 3.830 8.130

But in the log file /var/log/ntpd.log, I have only this:

 3 Mar 14:26:05 ntpd[8457]: Listen and drop on 0 v6wildcard [::]:123 3 Mar 14:26:05 ntpd[8457]: Listen and drop on 1 v4wildcard 0.0.0.0:123 3 Mar 14:26:05 ntpd[8457]: Listen normally on 2 lo 127.0.0.1:123 3 Mar 14:26:05 ntpd[8457]: Listen normally on 3 eth0 1.2.2.19:123 3 Mar 14:26:05 ntpd[8457]: Listening on routing socket on fd #20 for interface updates

I want to know when time is synchronized, and by how many seconds it changed on the local host when the sync was done. I think I need to increase the log file verbosity, but I don't know how to do this. Pls help. I couldn't find anything relevant in /etc/ntp.conf, even after reading man 5 ntp.conf.

1 Answer

You don't need increased log verbosity. What you need is to view (and probably graph) the statistics files in /var/log/ntpstats/, and/or monitor NTP through a monitoring system like collectd, nagios, prometheus, or telegraf.

Synchronisation is not a one-off event; it's something that happens constantly. NTP makes constant minor adjustments to the rate of the clock, not its value. So you shouldn't expect to see log messages saying ntpd has synced the clock; rather, in the stats files you'll see point-in-time samples of how well it is synced.

To see how well your local clock is doing, you'll want to look at loopstats. I made a (very rough) interactive graphing script to do that. You can check out how well your peers are doing by looking at peerstats. I made a similar script to do that. You can find out more about the stats files at

To monitor your system with one of the above-mentioned monitoring tools, check out NTPmon, starting at the top level of that repo.

If you are concerned about your clock's accuracy, the most important thing you should do is include more sources in your configuration. The NTP Best Current Practices (RFC8633) recommends a minimum of 4 sources, but using the pool directive and letting ntpd decide how many it needs is best.

(You probably also don't need burst in your server line - some NTP servers will block clients which use this; iburst is usually fine, though.)

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like