#!/usr/bin/perl -w use strict qw(refs vars); use POSIX; use IO::Handle; use IO::File; use File::Tail; use Parse::Syslog; die unless @ARGV; die if $ARGV[0] =~ m/^\-/; my $totail= pop @ARGV; sub run ($) { my ($object) = @_; my $parser= new Parse::Syslog $object, repeat=>0, arrayref=>1; while (my $sl= $parser->next) { print join("|", @$sl), "\n"; } } foreach my $staticpath (@ARGV) { if ($staticpath =~ m/\.gz$/) { my $fh= new IO::Handle; open $fh, '-|', 'gunzip', '--', $staticpath or die $!; run($fh); !$fh->error or die "$staticpath $!"; $!=0;$?=0; close $fh or die "$staticpath $! $?"; } else { my $fh= new IO::File '<', $staticpath or die $!; run($staticpath); !$fh->error or die "$staticpath $!"; close $fh or die "$staticpath $!"; } } my $tailer= new File::Tail name=>$totail, interval=>60, adjustafter=>2, ignore_nonexistant=>1, tail=>-1 or die "$totail $!"; run($tailer); die "huh?";