chrony does not log anything on my ec2 instance

i am trying to gather statistics from the chrony daemon on my EC 2 (Ubuntu 18.04.2 LTS) instance. i have followed aws's guide on how to set it up and it runs as expected.

i need to compare the time sync difference between aws and another service provider we use, that is why i enabled logging on chrony.

but it doesn't log anything in the /var/log/chrony folder

this is my configuration:

server 169.254.169.123 prefer iburst

pool ntp.ubuntu.com        iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Uncomment the following line to turn logging on.
log tracking measurements statistics

# Log files location.
logdir /var/log/chrony


# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3

i have checked permissions on the folder and everything, but there are no log files.

hope you guys can help me with that


I just verified chrony logging by doing the following:

  1. created a default Ubuntu 18.04 LTS EC2 instance - AMI id: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20180912 (ami-07a3bd4944eb120a0)
  2. installed chrony: sudo apt install chrony
  3. edited the default configuration in /etc/chrony/chronyd.conf to
    • add the AWS NTP source shown in your configuration above
    • uncomment the log tracking ... line
  4. restarted chrony: sudo service chrony restart
  5. confirmed that logging is working:
    root@ip-172-31-1-97:~# ls -la /var/log/chrony/
    total 32
    drwxr-xr-x  2 _chrony _chrony  4096 Mar  7 22:20 .
    drwxrwxr-x 10 root    syslog   4096 Mar  7 22:19 ..
    -rw-r--r--  1 _chrony _chrony 10686 Mar  7 22:22 measurements.log
    -rw-r--r--  1 _chrony _chrony  4797 Mar  7 22:22 statistics.log
    -rw-r--r--  1 _chrony _chrony  1854 Mar  7 22:21 tracking.log
    
  6. Confirmed that chrony is contacting its sources:
    root@ip-172-31-1-97:~# chronyc -n sources
    210 Number of sources = 9
    MS Name/IP address         Stratum Poll Reach LastRx Last sample               
    ===============================================================================
    ^* 169.254.169.123               3   6   377    48    +16us[  +46us] +/-  300us
    ^- 91.189.94.4                   2   7   241   103   +934us[ +957us] +/-  161ms
    ^- 91.189.91.157                 2   6    35    39  +2471us[+2471us] +/-  153ms
    ^- 91.189.89.199                 2   7    41   167  +1194us[+1203us] +/-  169ms
    ^? 2001:67c:1560:8003::c8        0   6     0     -     +0ns[   +0ns] +/-    0ns
    ^- 129.250.35.250                2   6   377    49   +914us[ +944us] +/-   93ms
    ^- 61.68.38.238                  3   6   377    49  -1395us[-1366us] +/-   59ms
    ^- 203.23.237.200                2   6   377    48  +2176us[+2176us] +/-   41ms
    ^- 150.101.217.196               2   6   377    48  -5039us[-5009us] +/-   76ms
    

So, my best guesses at the differences between your test and mine are:

  1. You've used a non-official Ubuntu 18.04 AMI

  2. You've used a non-official chrony package instead of just installing the one from the Ubuntu archives

  3. You've forgotten to restart chrony after changing the configuration


Have you tried looking to see if Chrony is logging to systemd? Try:

journalctl -u Chronyd.service