logo
logo

Andrew Richards
• The Free Stuff!

qmail-logmsg logging patch

On this page: • Introduction   • Download   • Installation   • Status/Warranty   • Compatibility   • License   • Programming Notes • Changelog • Archives

Introduction

This patch adds extensive logging to qmail-smtpd for netqmail-1.06. Initial connection through to message acceptance or rejection / disconnection is logged, with all log entries showing the process id and remote IP address to enable identification of individual SMTP sessions. Accepted messages are logged with the number of recipients. You can view an annotated sample log here.

A simple awk script is also provided to summarise logs; this collates information for each session onto a single line and adds the session duration. The awk script assumes log entries of the form produced by multilog (part of daemontools).

This patch was previously called qmail-errmsg but was renamed to qmail-logmsg to more accurately reflect its purpose.

It is based on some code John Levine was using, alas the original author is unknown. The error logging from that code has been enhanced and extended with assistance from John.

If you use 'sister' packages of netqmail you may also be interested in my related logging patches for rblsmtpd and serialmail, found here, also ofmipd-plus.

Download

The current release, version 1.3 is available in plaintext or gzipped (.gz).

Installation

Proceed as follows:

If you wish to summarise the logged data you can use scripts such as this one, to generate a summary like this.

Status / Warranty

No warranty, express or implied is given - USE THIS SOFTWARE ENTIRELY AT YOUR OWN RISK. You will need to satisfy yourself as to the suitability of this software before deploying it in a production environment.

Compatibility

The patch applies cleanly to netqmail-1.05 and netqmail-1.06. It does not apply cleanly to qmail-1.03. Other versions of qmail have not been tested. The awk script (if you use it) assumes logging with mulitlog.

Compatibility with common patches: This patch may conflict with other patches to netqmail/qmail; I've not explored this. If you're comfortable with 'manual' patching where conflicts arise you should be fine: The purpose of this patch is pretty clear and easy to follow when patching.

If you're not comfortable with 'manual' patching you may like to engage a qmail consultant such as the author.

License

The patch contains fairly obvious code, with bits from each author in turn: I and John Levine are happy for our contributions to this code to be freely available; with the original author being unknown I can't speak for him/her, but I believe they provided the original code without restrictions on its use, so there shouldn't be any problem there.

Programming Notes

Some variables in qmail-smtpd.c have been moved to enable their use in log messages.

Some code has been separated out into separate files (errbits.c, .h) for use in other qmail components and add-ons.

Changelog

Archives

Here are the previous versions of this patch:

This page last updated: AR, 1st July 2013.

This gratuitous space at the end ensures that the short-cuts to each section work properly