I am new with Perl, can someone help me?
I have the following LOG file, i want to extract the date (Thu Nov 30
14:12:07 CET 2006)
and the amount of httpd instances running (30). I am making the script and i
was able to
extract the number of instances but i really dont know how can i parse perl
to extract the
date.
I would really appreciate your help
Thanks
Ana
###########################LOG#########################
green Thu Nov 30 14:12:07 CET 2006 All processes are OK
&green /usr/local/apache2/bin/httpd -k start -DSSL >=1 - 30 instances
running
Status unchanged in 21.59 days
Status message received from 197.123.18.79
################## SCRIPT ####################################
open(LOG,"$log");
while ( defined ($line = <LOG>) ) {
chomp $line;
#print "$line\n";
# ensure colour is valid - ie don't graph purple results
if($line =~ /green|yellow|red/) {
# if($line =~ /(\d+)\s+instances/o){
$httpd=$1;
print "las instancias de $host son $httpd\n";
}
$colour_check="ok";
}
if ($colour_check ne "ok") {
print "$0: WARN $host is not showing red, yellow, or green. $log
skipped.\n" if ($ENV{'WARN'});
}
}
if ($colour_check=="ok"){
$text = "httpd instances: $httpd \n,";
####################################################################
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/ _______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs