Entry
How do I stop djbdns logging? Or limit the log output?
Mar 13th, 2002 02:29
Brian Coogan,
Significant performance increases have been reported when dnscache
logging is turned off; however it's important to note that these
improvements are generally only noticeable to users when your DNS
server is under very high load. Disabling logging can make problem
resolution either harder or impossible so think carefully first about
whether you really want to do it!
Probably the best solution for most people is to put -* in the multilog
run scripts (/service/*dns*/log/run) just after the 't' argument (or
put "exec cat >/dev/null" before the multilog command). This has the
advantage that you can turn logging back on later without restarting
dnscache. There is a slight overhead in that the logging data still
goes through a pipe to the multilog (or cat) commands. You could also
insert '+* stats*' to log just stats lines; with both this and -*
inserted, the log/run file looks like:
#!/bin/sh
exec setuidgid dnslog multilog t '-*' '+* stats*' ./main
ie: timestamp and only print stats lines.
As an extension on this you could use a recipe like this (thanks to Ray
@ Doubleclick):
#!/bin/sh
exec setuidgid dnslog multilog t \
-"* cached *" \
-"* lame *" \
-"* nodata *" \
-"* nxdomain *" \
-"* query *" \
-"* rr *" \
-"* sent *" \
-"* servfail *" \
-"* tx *" \
s1048576 n10 ./main
ie: don't log most common lines, 1Mb log files and keep 10 of them.
For details on how multilog works see
http://cr.yp.to/daemontools/multilog.html
A second (more severe!) method for stopping djbdns from logging is to
edit the run files to redirect the output to /dev/null. This avoids
the overhead of the logging data going through the pipe, but is less
flexible and not really a whole lot faster than keeping multilog but
writing less to disk as above.
That is, your /service/dnscache/run normally looks like this (line
break added):
#!/bin/sh
exec 2>&1
exec <seed
exec envdir ./env sh -c '
exec envuidgid dnscache softlimit -o250 \
-d "$DATALIMIT" /usr/local/bin/dnscache
'
And after the change it should look like this (inserting line 2):
#!/bin/sh
exec > /dev/null
exec 2>&1
exec <seed
exec envdir ./env sh -c '
exec envuidgid dnscache softlimit -o250 \
-d "$DATALIMIT" /usr/local/bin/dnscache
'
Once you've made the change run "svc -t /service/dnscache". To stop
tinydns logging follow similar steps with the tinydns run file.
This is sufficient to stop the logging writing to disk, but you may
also want to remove the 'log' subdirectory to finish the job. You
should use the appropriate svc -dx incantations when you remove the
directory (or simply 'rm -rf log' and reboot immediately afterwards):
cd /service/dnscache
mv log log.off
svc -dx log.off
rm -rf log.off
In my opinion, the extra performance provided by removing the logging
is probably not worth the lack of flexibility; I would prefer the first
method using the multilog patterns for the flexibility it offers and
for the fact that it gives most of the available speed increase.