the djb way


For the service installations described in the djb way, /var/multilog is used as the standard directory for access to multilog output.

multilog is the service logger included in the daemontools package. Its output, log rotation, and file naming conventions are distinct from other system loggers. Collecting all multilogs in one place, segregated from the output of other loggers, can help simplify administration and reduce confusion. By using a standard directory set up in /var/multilog, all multilog output may also be installed and monitored consistently.

Configuring for /var/multilog may be done in either of two ways:

  1. Within the logging run script itself; or

  2. With a symbolic link to the log/main directory of the service.

As an example of the first, consider this run script for a qmail-pop3d logger:

# qmail-pop3d/log/run
exec setuidgid multilog multilog t /var/multilog/qmail-pop3d

This shows multilog running with the reduced priveleges of the multilog user, member of group nofiles. Before starting the service, create the new directory within /var/multilog and set the ownership:

# mkdir -p /var/multilog/qmail-pop3d
# chown multilog /var/multilog/qmail-pop3d

After starting the service, the log may be monitored in real time with:

# tail -F /var/multilog/qmail-pop3d/current | tai64nlocal

[For OpenBSD, use tail -f to follow the log.]

As an example of using symlinks to /var/multilog, consider this run script for the tinydns logger, such as is installed automatically by running tinydns-conf:

# tinydns/log/run
exec setuidgid multilog multilog t ./main

We'll find that the tinydns-conf script has already made a logging directory in log/main and chown'd it to the multilog user for us. Although one could edit this run script and set up the log in /var/multilog as shown in the first example, most will find it simpler just to make a symbolic link:

# ln -s /var/svc.d/tinydns/log/main  /var/multilog/tinydns

The log can then be monitored as above with:

# tail -F /var/multilog/tinydns/current | tai64nlocal

With all the multilogs in the same place, administration may be simplified with a few basic shell scripts. For example:

# /usr/local/bin/watchlog
exec tail -F /var/multilog/$1/current | tai64nlocal

Used as:

# watchlog tinydns


While the symlink method is easier when working with auto-configured multilog setups (such as shown with tinydns-conf), and while multilog is a safe logger, not likely to run out of control and eat up your filesystem, there are good reasons why log files are traditionally segregated in the /var hierarchy (with /var mounted on a separate filesystem).

Note that when using /var/svc.d for local service definitions, auto-configured multilog setups will also use the filesystem mounted on /var as recommended. Nevertheless, for uniformity and consistency on our own systems, we do take the slight bit of extra trouble and install all multilogs in /var/multilog directly.

Copyright © 2002, 2003, 2004, Wayne Marshall.
All rights reserved.

Last edit 2004.10.04, wcm.