maillogs - A log file post-processer for multilog log files
maillogs <protocol> [-r] [-v] <protocol> is one of: smtp - report SMTP AUTH attempts and successes rbl - report RBL blocks send - report qmail-send counters pop3 - report pop3 counters imap - report imap counters spamassassin - report spamassassin counters qmailscanner - report qmailscanner counters webmail - count webmail authentications yesterday - mail an activity report to the admin
Maillogs is used in two different ways.
In its simplest form, you just run maillogs and telling it which type of logs you want want to process. It parses the log files in real time, updates the counter files it maintains, and prints out the counters.
A script that:
processes mail logs and generates counters from them. maintains counters for mail logs
Currently handles log counting of the following types:
qmail mail delivery (send) qmail-pop3d (pop3) courier pop3d (pop3) courier pop3dssl (pop3) courier imapd (imap) courier imapdssl (imap) vpopmail smtp-auth (smtp) sqwebmail (webmail) squirrelmail (webmail) rblsmtpd (rbl) spamasssassin (spamassassin) qmailscanner (qmailscanner)
I have "farms" of mail servers that share a hostname. I needed a way to collect the logs from all the servers and process them. maillogs is a piece of that puzzle that does several things.
takes qmail log files (/var/log/mail/[send|smtp|pop3]/current) parses them, saving counts of the logs active and stores them in counter files.
For smtp logs we count denied RBL connections, spam and virus denials, invalid message formats, and other forms of SMTP phase rejection.
For pop3, IMAP, webmail, and SMTP-AUTH, we count the number of connections and the number of successful logins.
Counters are written to files in /var/log/mail/counters/ by default. You can alter the locations of the logs files by editing the toaster.conf file included with this script. That file should be installed in /usr/local/etc.
Options are in toaster.conf
Installation is automatic when you install Mail-Toaster. The latest version can be downloaded from http://mail-toaster.org/
If the output of maillogs is not what you expect, you can run it in verbose mode to see status messages and verbose logging.
This program is a part of and requires Mail::Toaster to be installed.
Mail::Toaster - http://mail-toaster.org/ Date::Parse - CPAN as TimeDate Params::Validate - CPAN Carp - perl built-in English - perl built-in File::Path - perl built-in Getopt::Std - perl built-in Pod::Usage - perl built-in
Matt Simerson (email@example.com)
Copyright (c) 2004-2010 The Network People, Inc. (firstname.lastname@example.org). All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the The Network People, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.