Follow Multiple Files with OpenBSD “tail”

OpenBSD Logo

On UNIX, the tail[1] command displays the last ten lines of a file by default. But there are many other options: Especially the “follow” flag (-f) which displays all new lines appended to the watched file. This a very basic but efficient monitoring tool.

The GNU version of tail introduced a nice feature: It is possible to follow more than one file with the “-f” flag using the standard UNIX wildcards (“*”, “?”). Example:

# tail -f /var/log/*

Unfortunately, the tail provided with OpenBSD does not have this option. Recently I found a patch which adds this feature. The patch was released in 2006 and has never been integrated into the OpenBSD source tree but it works! I successfully tested in on a 3.9 and 4.2 servers.

Here is the patch:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.