[RFC] File::Rotate::Syslog - read from rotating syslog files

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

This is a follow up to my previous posting for File::Rotate. Comments also

       File::Rotate::Syslog - read from rotating syslog files

         use File::Rotate::Syslog;
         my $fh = new File::Rotate::Syslog(file      => $file,
                                           statefile => $statefile);
         die unless($fh);

         while (my ($epoch, $line) = $fh->geteline) {
             # do something with $epoch and $line

       File::Rotate::Syslog allows you to easily read regularly
       from syslog files that might be rotated and compressed,
       without worrying about finding the rotated log file,
       decompressing it and seeking to where you previously
       read from.

       This module is mostly useful for logfile analysis pro-
       grams run at regular intervals from cron(8). Derives
       directly from File::Rotate and provides one extra func-
       tion dealing specifically with the syslog(8) line for-

         Nov 29 04:31:10 mx01us spamd[25064]: connection from localhost

       Requires Date::EzDate from CPAN.

       $fh->geteline( ), $fh->geteline( prog => $program )

       Returns a two item list derived from the next line in
       the file. The first item is the date ('Nov 29 04:31:10')
       converted into the number of seconds since 1 Jan 1970
       (1101702670). The second item is a string containing the
       content of the log entry ('connection from localhost').

       The optional 'prog' argument allows you to restrict
       entries from a particular program.

       When the end of the rotated file is reached lines will
       be returned from the current $file. When the last line
       is reached returns 'undef'.

       File::Rotate methods

       File::Rotate::Syslog derives from File::Rotate and so
       all methods from that class are available as well.

       File::Rotate, Date::EzDate

Site Timeline