[Dnsmasq-discuss] Patch to change dnsmasq logentries

Olaf Westrik weizen_42 at ipcop-forum.de
Fri Feb 27 20:30:17 GMT 2009


Simon Kelley wrote:
> Carlos Carvalho wrote:
>> Olaf Westrik (weizen_42 at ipcop-forum.de) wrote on 27 February 2009 19:25:
>>  >As a matter of fact, changing the program name works better in my 
>> case.  >We do all the logging straight to /var/log/messages and then 
>> use regex's  >to separate.
>>  >Using program names dnsmasq, dnsmasq-dhcp and dnsmasq-tftp makes 
>> that a  >trivial exercise. Much easier than first filtering on 
>> dnsmasq and than  >identifying logs with and without DHCP:
>>
>> I think changing the name is bad practice; I know of no other daemon
>> that does it. I'm not saying this for me, because I don't use syslog
>> with dnsmasq; syslog is usually a bad solution, it's much better for
>> the daemon to write its own log. It should however have proper support
>> for this, namely permit log rotation through a signal, which dnsmasq
>> does.
That may be true, but I also know of few daemons that serve multiple 
purposes ;-)

In our case, having multiple files is not that easy. We simply log 
everything (ok almost everything), to 1 file and separate on a need only 
basis.
To do that we use this Perl regex: /^${monthstr} ${daystr} ..:..:.. 
[\w\-]+ ${section}: (.*)/
This allows us to search the logs for a specific section (dns, dhcp, 
kernel, internet connection etc.) for a specific date.

May not be nice, but keeps the amount of files easy to handle, only one 
logfile that needs to be rotated.
Also there are situations where we combine loginfo from several 
programs, daemons into one 'view', internet connection is best example 
for that.

So in fact changing the daemon name would work best for me.


I also agree that syslog is not optimal, but I regard it as something 
that is simply there and usually works.

>>
>>  >How about this:
>>
>>  > - Add an option --log-separation which is disabled by default.
>>
>> How about creating separate logs directly? We keep log-facility for
>> dns, and if {dhcp,tftp}-log-facility are defined the corresponding log
>> files are used, otherwise the entries are sent to log-facility. This
>> way we don't change what already exists, don't clutter the program and
>> don't obsolete the translations.
>>
> That's  nice idea. I can see two potential problems: 1) The syslog() 
> system is not extensible, so it would be necessary to (mis)use some 
> exiting facilities (FTP? LPR?). 2) It might be difficult for Olaf to 
> map from facility to his log-spliting facility.
>
Ouch. I think using other facilities than LOG_DAEMON is a no-no.
Would that not break remote logging as well as local logging? Both use 
the facility to separate into files.


> What do you think, Olaf?
>

I'm for changing the daemon name, optionally if so desired.
However I am open to other suggestions, since I use dnsmasq in what just 
might be a very specific way.


Olaf

-- 

A weizen a day helps keep the doctor away.




More information about the Dnsmasq-discuss mailing list