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