[Dnsmasq-discuss] Patch (v2) to change dnsmasq logentries

Olaf Westrik weizen_42 at ipcop-forum.de
Sat Feb 28 10:10:13 GMT 2009


Hi,


please consider attached patch against dnsmasq 2.47 for inclusion.
Purpose: easily identify and separate log messages for the DHCP and TFTP
part.
Messages from dnsmasq DHCP will be marked with dnsmasq-dhcp as daemon
name, TFTP will be marked with dnsmasq-tftp. This allows easier
separation for user presentation.

No message texts are touched, to avoid the need to re-sync the translations.

I have chosen not to use different facilities (current default is
LOG_DAEMON), as this IMHO would break syslog, syslog-ng and remote
syslog setups.

I purposely did not touch the various die() messages.


If this modification is too intrusive, I can cook up a patch to make
this behavior opt-in.

If there are any suggestions, improvements, etc., please feel free to
comment.


Example logging:
Feb 27 07:38:09 fw dnsmasq[29780]: started, version 2.47 cachesize 150
Feb 27 07:38:09 fw dnsmasq[29780]: compile time options: IPv6 GNU-getopt
no-DBus no-I18N TFTP
Feb 27 07:38:09 fw dnsmasq-dhcp[29780]: DHCP, static leases only on
192.168.3.1, lease time 1h
Feb 27 07:38:09 fw dnsmasq-dhcp[29780]: DHCP, IP range 192.168.2.2 --
192.168.2.50, lease time 1h
Feb 27 07:38:09 fw dnsmasq[29780]: reading /var/ipcop/red/resolv.conf
Feb 27 07:38:09 fw dnsmasq[29780]: using nameserver 192.168.1.1#53
Feb 27 07:38:09 fw dnsmasq[29780]: read /etc/hosts - 4 addresses
Feb 27 07:38:40 fw dnsmasq-dhcp[29780]: DHCPDISCOVER(lan-1)
00:12:3F:20:11:f1
Feb 27 07:38:40 fw dnsmasq-dhcp[29780]: DHCPOFFER(lan-1) 192.168.2.44
00:12:3F:20:11:f1
Feb 27 07:38:41 fw dnsmasq-dhcp[29780]: DHCPREQUEST(lan-1)
192.168.10.44 00:3F:56:20:11:f1
Feb 27 07:38:41 fw dnsmasq-dhcp[29780]: DHCPACK(lan-1) 192.168.2.44
00:12:3F:20:11:f1



Some background: IPCop is a Linux Firewall distribution, which (among
many other things) has a webinterface including log display.
Log messages are separated into different sections for better usability.
Some sections are kernel related, internet connection, IPsec tunnels,
etc. etc.
Separate log sections exist for DNS and DHCP server, which is not a
problem in our current version where we use ISC DHCP daemon and thus can
easily separate messages between the dnsmasq and dhcpd process.
However in the next major release we want to change that and use dnsmasq
as both DNS and DHCP server.

Now I could also use a search for DHCP in the log messages, but some
DHCP related log seem to lack such info.
I think that using a very easy to spot daemon name makes it trivially
easy for regex-ing.



thanks and keep up the good work

Olaf



PS: I have tried and tested the DHCP separation, which works for me
(famous last words ;-))

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dnsmasq-2.47-separate_log_entries.patch
Type: text/x-diff
Size: 16391 bytes
Desc: not available
Url : http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20090228/50f92e00/dnsmasq-2.47-separate_log_entries.bin


More information about the Dnsmasq-discuss mailing list