Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  SYSLOGSCAN::DELIVERYITERATOR (3)

.ds Aq ’


SyslogScan::DeliveryIterator -- scans a syslog file for "deliveries", successful transfers of mail to mailboxes or to other machines.



    use SyslogScan::Delivery;
    use SyslogScan::DeliveryIterator;
    my $iter = new SyslogScan::DeliveryIterator(syslogList =>
    my $delivery;
    while ($delivery = $iter -> next())
        print $delivery -> summary();


A DeliveryIterator goes through your sendmail logging file (which may be /var/log/syslog, /var/adm/messages, or something completely different) looking for successful deliveries of mail to local user-accounts or successful transfers of mail to remote machines.

Here is an excerpt from a sample syslog:

Jun 13 01:50:16 satellife sendmail[29556]: DAA29556: from=<>, size=954, class=0, pri=30954, nrcpts=1, msgid=<>, proto=ESMTP, []

Jun 13 01:50:17 satellife sendmail[29558]: DAA29556: to=<>, delay=00:00:05, mailer=fidogate, stat=Deferred (Remote host is busy)


Jun 13 14:55:50 satellife sendmail[29558]: DAA29556: to=<>, delay=13:00:05, mailer=fidogate, stat=Sent

The delivery is not registered until 14:55:50. In order to figure out the size and sender, the iterator needs to have gone over the ’from’ entry associated with message DAA29566, otherwise it will return a delivery with ’Sender’ and ’Size’ set to an undefined value (unless you specified defaults when constructing your DeliveryIterator.)


’new’ creates a new iterator.

    my $iter =
        new SyslogScan::DeliveryIterator(startDate => "06.01.96 18:00:00",
                                         endDate => "06.02.96 06:00:00",
                                         syslogList =>
                                         unknownSender => antiquity,
                                         unknownSize => 0,
                                         defaultYear => 1996);

All of the above parameters are optional.

startDate and endDate define a span of time; we ignore deliveries that fall before startDate or after endDate. This allows you to generate statistical reports about mail delivered over a given span of time.

syslogList is a list of files to search through for deliveries. The alternative to specifying syslogList is to supply a file-handle to a syslog file on each call to the next() method.

unknownSender and unknownSize are what to specify as the sender and the size if we cannot determine from the logs who sent the message and how large the message is.

defaultYear is the year in which the deliveries are assumed to have taken place (this is not specified in the syslog file.) Default is to guess the year that makes the delivery take place close to now. (For example, if ’now’ is February 3rd 1996, then by default a delivery made on December 14th is assumed to be in 1995, and a delivery made on February 4th is assumed to be in 1996.

defaultYear is deprecated, set the default year instead with SyslogScan::ParseDate::setDefaultYear.


Once an iterator is defined, the next() method will search for the next delivery, skipping any deliveries which don’t match the time constraints of startDate and endDate. There are two ways to call next():

    # poll syslogList members
    $delivery = $iter -> next;

    # poll filehandle
    $delivery = $iter -> next(\*LOG);


The ’appendSyslog’ method can add a syslog filename to the list of syslog filenames which were specified at construction time as ’syslogList’.

Setting the global variable $::gbQuiet to 1 will suppress some of the error messages to STDERR.


If two messages have the same message ID through a bad coincidence, a message is produced with sender of ’duplicate’ and size of ’0’ rather than using the unknownSender and unknownSize parameters.

Sender and receiver address are downcased automatically. It would probably be better if this module downcased only the host-name part of the address and not the user-name.

Some mailings have a ’ctladdr’ field; DeliveryIterator should probably try to parse this as a backup clue for figuring out the sender.


The author (Rolf Harold Nelson) can currently be e-mailed as

This code is Copyright (C) SatelLife, Inc. 1996. All rights reserved. This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

In no event shall SatelLife be liable to any party for direct, indirect, special, incidental, or consequential damages arising out of the use of this software and its documentation (including, but not limited to, lost profits) even if the authors have been advised of the possibility of such damage.


SyslogScan::Delivery, SyslogScan::Summary
Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 SYSLOGSCAN::DELIVERYITERATOR (3) 1997-01-29

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.