Note that all of the qmail-start startup scripts in this document should all be on one line.
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.
csh -cf 'qmail-start ./Mailbox /usr/local/bin/usually /var/qmail/log/pattern | /usr/local/bin/setuser qmaill /usr/local/bin/accustamp | /usr/local/bin/setuser qmaill /usr/local/bin/cyclog /var/qmail/log/qmail &'
This will use the file /var/qmail/log/pattern as the matching file. The usually man page describes the pattern syntax. The qmail-log man page describes all the possible strings that you can expect. Here is a sample pattern file to catch a reasonable amount of information:
running* local deliveries will be put on* remote deliveries will be put on* number of deliveries left before exiting:* exiting* alert:* delivery *: failure* delivery *: report mangled, will defer* internal error:* qmail-clean unable to clean up* trouble* unable* unknown*
You may want to also catch "delivery*", though this will significantly increase the amount of information in your logs. If you would like to grab it all (i.e. you want to easily change it in the future), just make the pattern file contain an asterisk on a single line.