The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::Toaster::Logs - objects and functions for interacting with email logs

This module contains functions related to mail logging and are used primarily in maillogs. Some functions are also used in toaster-watcher.pl and toaster_setup.pl.

METHODS

new

Create a new Mail::Toaster::Logs object.

    use Mail::Toaster::Logs;
    $logs = Mail::Toaster::Logs->new;
report_yesterdays_activity

email a report of yesterdays email traffic.

verify_settings

Does some checks to make sure things are set up correctly.

    $logs->verify_settings;

tests:

  logs base directory exists
  logs based owned by qmaill
  counters directory exists
  maillogs is installed
parse_cmdline_flags

Do the appropriate things based on what argument is passed on the command line.

        $logs->parse_cmdline_flags(prot=>$prot, verbose=>0);

$prot is the protocol we're supposed to work on.

check_log_files
        $logs->check_log_files( $check );
compress_yesterdays_logs
        $logs->compress_yesterdays_logs( $file );
count_rbl_line
    $logs->count_rbl_line($line);
count_send_line
 usage:
     $logs->count_send_line( $count, $line );

 arguments required:
      count - a hashref of counter values
      line  - an entry from qmail's send logs

 results:
     a hashref will be returned with updated counters
counter_read
        $logs->counter_read( file=>$file );

$file is the file to read from. The sub returns a hashref full of key value pairs.

counter_write
        $logs->counter_write(log=>$file, values=>$values);

 arguments required:
    file   - the logfile to write.
    values - a hashref of value=count style pairs.

 result:
   1 if written
   0 if not.
imap_count
        $logs->imap_count;

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

pop3_count
        $logs->pop3_count;

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

process_pop3_logs
process_rbl_logs
    process_rbl_logs(
        roll  => 0,
        files => $self->check_log_files( "$logbase/smtp/current" ),
    );
process_send_logs
qms_count
        $logs->qms_count;

Count statistics logged by qmail scanner.

purge_last_months_logs
        $logs->purge_last_months_logs(
        fatal   => 0,
        );

For a supplied protocol, cleans out last months email logs.

rbl_count

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

        $logs->rbl_count(
roll_rbl_logs
        $logs->roll_rbl_logs;

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

RollPOP3Logs
        $logs->RollPOP3Logs;

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

roll_send_logs
        $logs->roll_send_logs;

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

send_count
        $logs->send_count;

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

smtp_auth_count
        $logs->smtp_auth_count;

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

spama_count
        $logs->spama_count;

Count statistics logged by SpamAssassin.

syslog_locate
        $logs->syslog_locate;

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.

webmail_count
        $logs->webmail_count;

Count the number of webmail authentications.

AUTHOR

Matt Simerson <matt@tnpi.net>

BUGS

None known. Report any to author. Patches welcome.

SEE ALSO

The following are relevant man/perldoc pages:

 maillogs
 Mail::Toaster
 toaster.conf

 http://mail-toaster.org/

COPYRIGHT

Copyright (c) 2004-2008, The Network People, Inc. 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.