Last Updated: 980323
cyclog
Introduction
A problem with using splogger is that it uses syslog. Syslog has
problems. It has bugs, security holes, etc. Also, using splogger with
syslog out of the box is not very configurable. A solution to this
problem is to use cyclog, the logging program shipped with daemontools.
You can download daemontools from the
daemontools web page. It is relatively simple to compile and
install.
Note that all of the qmail-start startup scripts in this document should
all be on one line.
setuser
A utility which comes with daemontools is setuser which will run a program
as another user. Keep in mind that root is the only user which can use
setuser. In the following examples, we will be piping output through
several programs. The first will be run as the appropriate user (qmaill),
but the rest will be run as root since it is a shell script run by root.
This is not the behavior we want. The logging facility should be run
as qmaill also. setuser will give us the ability to run everything
under the appropriate user id.
cyclog
cyclog is a simple logging facility. It has three simple options
which are very well explained in the man page.
Let's expand the standard qmail startup to include cyclog:
csh -cf 'qmail-start ./Mailbox /usr/local/bin/accustamp | /usr/local/bin/setuser qmaill /usr/local/bin/cyclog /var/qmail/log/qmail &'
The first program, "accustamp", places a time stamp in microseconds at the
beginning of each line. The output of accustamp is sent to cyclog
(which is started as user qmaill) which
will put the entries into the directory /var/qmail/log/qmail/ (which must
already exist). Sites which move lots of traffic will definitely want to
change the default options on cyclog (or else you will find yourself with only
a few hours worth of logs). It will run as the user qmaill, so be sure the
directory is writeable by this user.
Written by Eric Huss
Comments welcome.