NAME
Parse::Syslog::Mail - Parse mailer logs from syslog
VERSION
Version 0.02
SYNOPSIS
use Parse::Syslog::Mail;
my $maillog = Parse::Syslog::Mail->new('/var/log/syslog');
while(my $log = $maillog->next) {
# do something with $log
# ...
}
DESCRIPTION
As its names implies, Parse::Syslog::Mail presents a simple interface to gather mail information from a syslog. It uses Parse::Syslog for reading the syslog, and offer the same simple interface.
METHODS
- new()
-
Creates and returns a new
Parse::Syslog::Mailobject. A file path or aFile::Tailobject is expected as first argument. Options can follow as a hash. Most are the same as forParse::Syslog::new().Options
year- Syslog files usually do store the time of the event without year. With this option you can specify the start-year of this log. If not specified, it will be set to the current year.GMT- If this option is set, the time in the syslog will be converted assuming it is GMT time instead of local time.repeat-Parse::Syslogwill by default repeat xx times events that are followed by messages like"last message repeated xx times". If you set this option to false, it won't do that.locale- Specifies an additional locale name or the array of locale names for the parsing of log files with national characters.allow_future- If true will allow for timestamps in the future. Otherwise timestamps of one day in the future and more will not be returned (as a safety measure against wrong configurations, bogus --year arguments, etc.)
Example
my $syslog = new Parse::Syslog::Mail '/var/log/syslog', allow_future => 1; - next()
-
Returns the next line of the syslog as a hashref,
undefwhen there is no more lines. The hashref contains at least the following keys:timestamp- Unix timestamp for the event.id- Local transient mail identifier.
Other keys are the corresponding fields from a Sendmail entry.
from- Email address of the sender.to- Email addresses of the recipients, coma-separated.msgid- Message ID.relay- MTA host used for relaying the mail.status- Status of the transaction.
Example
while(my $log = $syslog->next) { # do something with $log }
DIAGNOSTICS
- Can't create new %s object: %s
-
(F) Occurs in
new(). As the message says, we were unable to create a new object of the given class. The rest of the error may give more information. - Expected an argument
-
(F) You tried to call
new()with no argument. - First argument of new() must be a file path of a File::Tail object
-
(F) As the message says, you must give to
new()a valid (and readable) file path or aFile::Tailobject as first argument.
SEE ALSO
AUTHOR
Sébastien Aperghis-Tramoni <sebastien@aperghis.net>
BUGS
Please report any bugs or feature requests to bug-parse-syslog-mail@rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-Syslog-Mail. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
CAVEATS
Most probably the same as Parse::Syslog, see "BUGS" in Parse::Syslog
COPYRIGHT & LICENSE
Copyright 2005 Sébastien Aperghis-Tramoni, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.