Hi there, thanks for your answer.
I do have a complete version of my question that I setuped using the File::Tail examples, but I was trying to avoid it because for that I need to compile an executable with PAR wich makes a huge bin file (I dont have permission to setup the File::Tail module on the destination server)... oh well!..
Wont the incomplete line be caugth on the next cycle? Need to do a bit to bit count?!
So if I need to get stuck with the code bellow how can I do and "uniq" ou the fectched regex values on "$_->read;"
Best Regards,
NMA
#!/usr/bin/perl
use warnings;
use strict;
use File::Tail;
my $ConfFile="watchtelecom.conf";
my @LogFiles;
my @Files;
my $nfound;
my $timeleft;
my @pending;
my $timeout;
my $ErrorPatern="error"; #testing purpuses.
#my $ErrorPatern="Input: Error reading in input stream";
my $test;
my $x;
open(CONFFILE, "$ConfFile") or die("Could not open $ConfFile.");
foreach (<CONFFILE>) {
push(@LogFiles,$_);
}
close(CONFFILE) or die("Could not close $ConfFile.");
foreach (@LogFiles) {
push(@Files,File::Tail->new(name=>"$_", maxinterval=>1800));
}
while (1) {
($nfound,$timeleft,@pending)=
File::Tail::select(undef,undef,undef,$timeout,@Files);
foreach (@pending) {
my $telcoline=$_->read;
if ($telcoline =~ /$ErrorPatern/) {
#print $_->{"input"}." (".localtime(time).") ".$_->read;
if ($_->{"input"} =~ /TMN/) {
print "Via Vodafone: $telcoline";
$test=$telcoline;
} else {
print "Via TMN: $telcoline";
$test=$telcoline;
}
}
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.