Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: trouble parsing log file...

by perl_geoff (Acolyte)
on Nov 25, 2006 at 19:23 UTC ( #586039=note: print w/ replies, xml ) Need Help??


in reply to Re^3: trouble parsing log file...
in thread trouble parsing log file...

Hey, I tried using this module, but I'm still running into the same problem as my other script...can you show me where I'm going wrong?

use strict; use warnings; my $logfile="log.txt"; my $error="DOWN"; my $warn="PROBLEM"; my $redbutton="\<img src\=\'default_files/perlredblink\.gif'>"; my $greenbutton="\<img src\=\'default_files/perlgreenblink\.gif'>"; my $yellowbutton="\<img src\=\'default_files/perlyellowblink\.gif'>"; my $button = $greenbutton; # open LOG, $logfile or die "Cannot open $logfile for read :$!"; use File::Tail; tie *LOG, 'File::Tail', (name => $logfile, tail => -1) or die("log open error: $!"); while (my $line = <LOG>) { if ($line eq $error) { $button = $redbutton; print "<!--Content-type: text/html-->\n\n"; print $button; last; } elsif ($line eq $warn) { $button = $yellowbutton; print "<!--Content-type: text/html-->\n\n"; print $button; last; } else { print "<!--Content-type: text/html-->\n\n"; print $button; last; } } close LOG;


Comment on Re^4: trouble parsing log file...
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://586039]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-07-30 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls