[syslog-ng]SIGHUP res_init feature request

Ted_Rule@flextech.co.uk Ted_Rule@flextech.co.uk
Wed, 4 Sep 2002 15:35:55 +0100


Following on from some experience with DNS misbehaviour on an old syslogd
instance,
I was forced to add the ability to force a re-read of resolv.conf upon SIGHUP.
This allowed me to
change the DNS server that a given central syslog server interrogated without
requiring
a complete restart of the daemon - which would otherwise have potentially lost
messages.

Without this tweak, a given process effectively "caches forever" the contents of
resolv.conf
during the first call to gethostbyaddr().

In particular, if I needed to take out a given DNS server for
maintenance/upgrade, I could swing
DNS service elsewhere and avoid disrupting the natural behaviour of the syslog
daemon.

As far as I can tell syslog-ng doesn't have this feature. As far as I can tell,
adding the feature
merely requires 2 extra lines of code in main.c as per below.

If it meets general approval, perhaps the feature could be added in the next
patch release.



Ted

Within:

/usr/src/syslog-ng/syslog-ng-1.5.20/src/main.c


add the following:


........


#include <resolv.h>      <<<extra line

........


                if (sighuprecvd) {
                        sighuprecvd = 0;
                        if (!backend->super.reloading) {

                                notice("SIGHUP received, restarting
syslog-ng\n");
          res_init();         <<< extra line
                                if (!debug_flag) {
                                        set_error_stream(2, 0);
                                        set_internal_cfg(NULL);
                                }
                                backend->super.reloading = 1;
                                reload_config = 1;
                                r.backend = backend;
                                r.state = -1;
                                /* wait a second to flush buffers */
                                io_callout(&backend->super, 1, &r.super);
                        }
                }


........








***************************************************************************************************

This E-mail message, including any attachments, is intended only for the person
or entity to which it is addressed, and may contain confidential information.

If you are not the intended recipient, any review, retransmission, disclosure,
copying, modification or other use of this E-mail message or attachments is
strictly forbidden.

If you have received this E-mail message in error, please contact the author and
delete the message and any attachments from your computer.

You are also advised that the views and opinions expressed in this E-mail
message and any attachments are the author's own, and may not reflect the views
and opinions of FLEXTECH Television Limited.

***************************************************************************************************