Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

alert_log_perl

$
0
0
#!/usr/local/bin/perl -w

# Description : This is the program to analyze the alert log
#               file and print out diagnostics.

format top =
                 LOG SWITCH REPORT
                 +++++++++++++++++
 Time                                    Sequence
 __________________                      _____________
.
format STDOUT =
@<<<<<<<<<<<<<<<<<<                      @<<<<<<<<<<<<
substr("$TEST",3,13), $SEQ[$#$SEQ]
.
if ( ! $ENV{"ALERT"} ) {
  print "Set enviornment variable ALERT to Alert Log file location ! \n";
  exit(1);
}

open (FH,$ENV{"ALERT"});
while (<FH>) {
    if (/Mon|Tue|Wed|Thu|Fri|Sat|Sun/) {
       $TEST = $_;
       next;
    }
    # This is global variable , Global because we use it in format statement
    # Convert Input line into array and print last element which is sequence number
    # $var[$#$var] is like $NF in awk
    @SEQ = split / /;
    write if /Thread.*advanced/;
}
close(FH);

Viewing all articles
Browse latest Browse all 1640

Trending Articles