[Kea-users] Log rotation - SIGHUP?

Thomas Markwalder tmark at isc.org
Tue Nov 15 11:47:55 UTC 2016


On 11/14/16 5:44 PM, MRob wrote:
> On 2016-11-14 05:22, Thomas Markwalder wrote:
>> On 11/14/16 12:44 AM, MRob wrote:
>>> After rotating Kea logs, is a SIGHUP sufficient to get each of the Kea
>>> servers to start using their new log files?
>>> _______________________________________________
>>> Kea-users mailing list
>>> Kea-users at lists.isc.org
>>> https://lists.isc.org/mailman/listinfo/kea-users
>>
>> Hello:
>>
>>
>> It should be. Ultimately it depends on how you've configured your
>> logging and how you are rotating the log the files.  Sending SIGHUP will
>> cause Kea servers to reload their configuration, which in turn will
>> cause it to reconfigured its loggers.  If you have configured your
>> logger(s) to write to explicit files, the files will be closed and
>> reopened.
>>
>> If the only reason you're issuing the SIGHUP is to rotate the files,
>> there are ways to do it without causing the server to reload its
>> configuration.  The most obvious way would be to use the "syslog" log
>> destination and configure syslog (or rsyslog depending on your OS) to do
>> the log rotation for you.
>>
>> If you prefer using explicitly named files and managing the log rotation
>> on your own, then you could simply copy the Kea log file to the
>> appropriate rotate name, cat /dev/null to the Kea log file, and you're
>> done,  no  SIGHUP necessary.   For example, if your logger config
>> were this:
>>
>> "Logging":
>> {
>>   "loggers": [
>>     {
>>       "name": "kea-dhcp4",
>>       "output_options": [
>>           {
>>             "output": "/tmp/kea.log"
>>           }
>>       ],
>>       "severity": "DEBUG",
>>       "debuglevel":99
>>     }
>>   ]
>> }
>>
>> Then as root, you could do something like this:
>>
>>
>> # cp /tmp/kea.log /tmp.kea.log.1
>>
>> # cat /dev/null > /tmp/kea.log
>>
>> This works fine for me under Centos.
>>
>> Hope that helps.
>
> Thank you. I'm adding a kea entry to the logrotate system - although I
> can make logrotate do as you suggest ("copytruncate" option), I prefer
> more atomic action of move old file.
>
> Is SIGHUP extremely disruptive to Kea?
>
Well it does instruct Kea to reload it's entire configuration, which
depending on the site can be costly.  If you're using Memfile with
persistence enabled (default) it will reload the lease file, etc.
> _______________________________________________
> Kea-users mailing list
> Kea-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/kea-users




More information about the Kea-users mailing list