log tools

Some scripts to analyze qpsmtpd log files.

Warning: There is no single log file format for qpsmtpd. It depends on which logging plugin you use and through which mechanism you log (e.g., directly to files, through daemontools, through syslog, ...). The tools on this page work with the logfile format produced by logging/file_connection. If you use a different logging plugin, you probably will have to adapt these scripts to your needs.

parselog.pm - logfile parser
A simple module to parse logfiles. Provides a function parse which parses the log file and invokes a callback function for every completed transaction and a function msg2key, which maps SMTP replies to simple keys (e.g. 550 Uh-huh. You.re .*, and I.m a boil on the bottom of the Marquess of Queensbury.s great-aunt is mapped to badhelo).
qgrep - filter qpsmtpd log files
qpsmtpd writes very detailed log files. Each connection creates many lines of log output. This script simplifies searching through qpsmtpd logs by treating all the lines for a single connection (identified by the second field of each line) as a single string which is then filtered through perl grep (option -g) and map (option -m) operations.
rcpt-results2 - Create per-recipient extracts from log files
This script determines for each mail transaction (whether it was successful or not) the intended recipients of the mail and creates for each recipient an HTML file containing the SMTP dialogue of each transaction (without the contents of DATA of course) and a summary table with the recipient addresses and the results. It relies on log entries written by the aliases_check plugin to find out the "real" recipients.
transaction-results3 - Per domain result summary
Extract a summary with 3 columns from a logfile: target domain, result key and count.
collapse_qpsmtpd_conn - collapse connections from qpsmtpd logs to a single line
collapse_qpsmtpd_conn extracts commands and responses from qpsmtpd log files and prints a single line for each connection with the entire SMTP dialog. The output is intended to be easily filtered with grep or awk.
greylist_dump
Dumps the contents of the database of the denysoft_greylist plugin.
greylist_stats
Script to extract various statistics about the behaviour of the denysoft_greylist plugin from logfiles. The output is somewhat raw and very verbose.
transaction-results
creates a pie graph with the distribution of the "results" of SMTP transactions from the output of collapse_qpsmtpd_conn. This is a bit fuzzy, because a transaction can have several results (if there are several recipients the mail can be accepted for some but not for others) but it gives a general idea of the efficiency of various filters. Here is an example: pie graph