Mail::Toaster::Logs

- NAME
- SYNOPSIS

- CheckSetup
- CheckForFlags
- CountRBL
- CountSMTP
- CountSend
- CountIMAP
- CountPOP3
- CountWebMail
- CountSpamA
- CountQMS
- RollSendLogs
- RollRblLogs
- RollPOP3Logs
- CompressYesterdaysLogfile
- PurgeLastMonthLogs
- RotateMailLogs
- SetupDateVariables
- CheckLogFiles
- ProcessPOP3Logs
- ProcessRblLogs
- CountRblLine
- ProcessSendLogs
- CountSendLine
- ReadCounters
- WriteCounters
- WhatAmI
- SetSyslog

- Design considerations
- AUTHOR
- BUGS
- SEE ALSO
- COPYRIGHT

# NAME

Mail::Toaster::Logs

# SYNOPSIS

Perl modules related to mail logging. These modules are used primarily in maillogs but will be used in ttoaster-watcher.pl and toaster_setup.pl as well.

## CheckSetup

            use Mail::Toaster::Logs;
            CheckSetup($conf);

## CheckForFlags

            use Mail::Toaster::Logs;
            CheckForFlags($conf, $prot, $debug);

$conf is a hashref of configuration values, assumed to be pulled from toaster-watcher.conf.$prot is the protocol we're supposed to work on. Do the appropriate things based on what argument is passed on the command line.

## CountRBL

            use Mail::Toaster::Logs;
            CountRBL($conf, $debug);

Count the number of connections we've blocked (via rblsmtpd) for each RBL that we use.

## CountSMTP

            use Mail::Toaster::Logs;
            CountSMTP($conf, $syslog, $debug);

Count the number of times users authenticate via SMTP-AUTH to our qmail-smtpd daemon.

## CountSend

            use Mail::Toaster::Logs;
            CountSend($conf, $debug);

Count the number of messages we deliver, and a whole mess of stats from qmail-send.

## CountIMAP

            use Mail::Toaster::Logs;
            CountIMAP($conf, $syslog, $debug);

Count the number of connections and successful authentications via IMAP and IMAP-SSL.

## CountPOP3

            use Mail::Toaster::Logs;
            CountPOP3($conf, $syslog, $debug);

Count the number of connections and successful authentications via POP3 and POP3-SSL.

## CountWebMail

            use Mail::Toaster::Logs;
            CountWebMail($conf, $syslog, $debug);

Count the number of webmail authentications.

## CountSpamA

            use Mail::Toaster::Logs;
            CountSpamA($conf, $syslog, $debug);

Count statistics logged by SpamAssassin.

## CountQMS

            use Mail::Toaster::Logs;
            CountQMS($conf, $syslog, $debug);

Count statistics logged by qmail scanner.

## RollSendLogs

            use Mail::Toaster::Logs;
            RollSendLogs($conf, $debug);

Roll the qmail-send multilog logs. Update the maillogs counter.

## RollRblLogs

            use Mail::Toaster::Logs;
            RollRblLogs($conf, $debug);

Roll the qmail-smtpd logs (without 2>&1 output generated by rblsmtpd).

## RollPOP3Logs

            use Mail::Toaster::Logs;
            RollPOP3Logs($conf);

These logs will only exist if tcpserver debugging is enabled. Rolling them is not likely to be necessary but the code is here should it ever prove necessary.

## CompressYesterdaysLogfile

            use Mail::Toaster::Logs;
            CompressYesterdaysLogfile($conf, $file, $debug);

You'll have to guess what this does. ;)

## PurgeLastMonthLogs

            use Mail::Toaster::Logs;
            PurgeLastMonthLogs($conf, $protdir, $debug);

Keep guessing...

## RotateMailLogs

            use Mail::Toaster::Logs;
            RotateMailLogs(@dirs);

Tell multilog to rotate the maillogs for the array of dirs supplied.

## SetupDateVariables

            use Mail::Toaster::Logs;
            SetupDateVariables($offset);

## CheckLogFiles

            use Mail::Toaster::Logs;
            CheckLogFiles(@check);

## ProcessPOP3Logs

## ProcessRblLogs

## CountRblLine

## ProcessSendLogs

## CountSendLine

## ReadCounters

            use Mail::Toster::Logs;
            ReadCounters($file, $debug);

$file is the file to read from. $debug is optional, it prints out verbose messages during the process. The sub returns a hashref full of key value pairs.

## WriteCounters

            use Mail::Toster::Logs;
            WriteCounters($file, %values);

$file is the logfile to write to.

%values is a hash of value=count style pairs.

## WhatAmI

            use Mail::Toaster::Logs;
            WhatAmI(;$debug)

Determine what the filename of this program is. This is used in maillogs, as maillogs gets renamed in order to function as a log post-processor for multilog.

## SetSyslog

            use Mail::Toaster::Logs;
            SetSyslog();

Determine where syslog.mail is logged to. Right now we just test based on the OS you're running on and assume you've left it in the default location. This is easy to expand later.

# Design considerations

- Counters will be polled via SNMP. Script must be able to return counts instantly, even when dealing with HUGE logs.
- Must work with multilog and syslog logging formats
- Outputs data in a format suitable for polling via SNMP
- Simple configuration
- Fail safe, errors must be noticed and reported but not fatal

# AUTHOR

Matt Simerson <matt@tnpi.biz>

# BUGS

None known. Report any to author.

# SEE ALSO

http://www.tnpi.biz/internet/mail/toaster/

Mail::Toaster::CGI, Mail::Toaster::DNS, Mail::Toaster::Logs, Mail::Toaster::Qmail, Mail::Toaster::Setup

# COPYRIGHT

Copyright 2003, The Network People, Inc.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.