Please could the wise folks give me some help. Something is wrong and I can not find out what.
When I run this program it returns everything is OK (Suspect a logic error somewhere), which is not possible as the logs in question do have data that I require (i.e. ORA-12571: TNS:packet writer failure). This script is to check the Oracle Logs for errors beginning with "ORA-" i.e. ORA-013100 Then it should return only the errors. You will see I try to reverse the file as I only want the newest errors first, anyway I want to build that functionality into it eventually that I can set a limit...but that is for later. Here is my script. ****************************** SNIP *********************************** #!/usr/bin/perl -w use strict; use warnings; # use POSIX 'strftime'; # For later functionality. # my $day = (strftime('%w', localtime()) - 1); # Save all the sites to be checked in a text file # Example line:- # OrcaleSid:://windowsserver/share/directory/logfile.log open SITES, "c:/denham/dba/sites/alrtlogs.txt" || die "Can not Open alrtlogs.txt: $!"; # Now while through the file and do each site. while (<SITES>) { (my $sid, my $loc) = split(/::/); chomp($sid); chomp($loc); print "~~~~~~~~~~~~~~~~~~~~~~~~\n"; print "~~ Checking $sid ~~\n"; print "~~~~~~~~~~~~~~~~~~~~~~~~\n"; # open the LogFile open SITELOG, "$loc" ||die "Can not open $loc: $!"; # I suspect that my mistake may be around here :-) # Check the file for any ORA- entries if($_ =~ m/ORA-/) { # If it contains records, reverse the file my @lines = reverse($_); my $rownum = 0; # Starting from the last line look for the error for my $line($lines[$rownum]) { if ($lines[$rownum] =~ m/ORA-/) { print "$lines[$rownum]\n"; } $rownum = $rownum + 1; } }else{ print "Nothing to Report\n"; } close SITELOG; } *************************************** SNIP COMPLETE****************************** Many Thanks Denham