Score:0

Chrony doesn't rotate logs after logrotate

cg flag

I have the following logrotate configuration:

   /var/log/chrony/*.log {
    daily
    missingok
    nocreate
    maxage 5
    sharedscripts
    postrotate
        /usr/bin/chronyc -a cyclelogs > /dev/null 2>&1 || true
    endscript 
  }

The first time logrotate runs, it copies all of the chrony log files to files with extensions .log. just as it's supposed to. My expectation is that after this happens, the postrotate should run and chronyc should make new files ending in .log. This doesn't happen. For example, this is my directory listing right now:

[log]# ls /var/log/chrony
measurements.log-20210727  statistics.log-20210727  tracking.log-20210727

If I run the logrotate command by hand this is what I get

[log]# /usr/bin/chronyc -d -a cyclelogs
Resolved 127.0.0.1 to 127.0.0.1
Resolved ::1 to ::1
Opening connection to /var/run/chrony/chronyd.sock
Sent 28 bytes
Timeout 0.999857 seconds
Received 28 bytes
Reply cmd=37 reply=1 stat=0
200 OK

So this looks like it succeeded but the directory listing doesn't change. No new logfiles are created and new log messages are still written to the rotated files. The really strange thing is that I have this logrotate script on like 50 servers and it works on a handful. All servers are running CentOS 7 (several different versions of CentOS 7, but no pattern I can see). All servers are running chrony-3.2-2.el7

I don't think logrotate is the issue here, since running the cyclelogs command doesn't seem to do the right thing even if I run it outside of logrotate. Am I misunderstanding what cyclelogs is supposed to do? Note that if I restart chronyd, it does make the new log files as I would expect

mlichvar avatar
cn flag
The new log files don't appear immediately. They are created when the first entry is written, i.e. when an NTP measurement is made. Is the client polling a server and is the server synchronized and responding?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.