[ntp:questions] ntpd interfacing with newsyslog/logrotate?

A C agcarver+ntp at acarver.net
Sun Apr 22 02:45:21 UTC 2012


On 4/21/2012 16:19, Steve Kostecke wrote:
> On 2012-04-21, unruh<unruh at invalid.ca>  wrote:
>
>> On 2012-04-21, A C<agcarver+ntp at acarver.net>  wrote:
>>
>>> Does anyone familiar with NetBSD know if there's a particular
>>> configuration for newsyslog that will allow the main ntpd log to
>>> rotate on a regular basis? It seems that ntpd loses track of its log
>>> file during a rotate and stops updating.
>>
>> I do not know, but it is possible that ntpd does not regualrly close
>> its log files.
>
> ntpd does rotate the stats log files. See
> http://doc.ntp.org/4.2.6p5/monopt.html#filegen

Right, I already have those rotating.  I'm talking about the main log file.

>
>> Thus when the log file gets moved (renamed) and a new log file
>> opened, ntp keeps using the old one (remmeber that the files are not
>> referenced by name but by inode). So look in the old file and see if
>> it is being updated. Then you have to persuade ntpd to close the old
>> log files and then reopen which will open the new one.
>
> ntpd can log to either the system syslog facility or the alternate
> logfile log file. See http://doc.ntp.org/4.2.6p5/miscopt.html#logconfig
>
> I have, in the past (e.g. with ntp3), seen that if you specify a
> separate logfile with the 'logfile' directive that it is not rotated the
> way that 'filegen' files are.
>
> If you use ntpd with the system syslog facility log rotation is not an
> issue.

I have ntpd logging to its own log file away from syslog (using the 
logfile directive) so I can more easily monitor its behavior.  The 
problem is this doesn't seem to be capable of logging unless I've 
somehow missed a setting either in the ntp.conf file or in the newsyslog 
conf file.

Most other programs simply accept a SIGHUP or SIGUSR to trigger a drop 
and restart but it doesn't seem to work for ntpd.  Once the log rotates, 
nothing is ever written to the new log file or the old one or syslog. 
Things just disappear.


More information about the questions mailing list