@rem = '-*- Perl -*-';
@rem = '
@echo off
perl %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
goto endofperl
';

# perl script to extract BOS data for dashboarding
# Version 1.0 08/05/2001 - shambo
# Standard 3 step perl - no frames or images downloaded

# 3 error columns in all routines
# unable to connect
# timeout
# server error 

($arg1) = @ARGV[0];

sub convert_time;

$daycount= "$arg1";
$blank="0";
$err="Yes";
$noerr="No";

# Global Variables
#
$LOGDIR="//usnt0125/testdata/Sitescope/usbh4";
$OUTDIR="//usnt0125/testdata/Sitescope/usbh4/BOS";

$gb1day = "_$gbday";
$gb1month = "_$gbmonth";

# Format the date correctly 
#
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(time-($daycount * 86400));
$thisdayofweek= (Sun, Mon, Tue, Wed, Thu, Fri, Sat) [$wday];
$thismonth= ("0" x (2-length($mon + 1))) . ($mon + 1);
$thisday= ("0" x (2-length($mday))) . $mday;
$thisyear = $year + 1900;
$thishour = $hour +1;

if ($min < 10) {
      $mymin = "0$min";
    }

if ($min > 9) {
      $mymin = "$min";
    }

if ($thishour < 10) {
      $myhour = "0$thishour";
    }

if ($thishour > 9) {
      $myhour = "$thishour";
    }

if ($thismonth < 10) {
      $mymonth = "_$thismonth";
    }

if ($thismonth > 9) {
      $mymonth = "_$thismonth";
    }

if ($thisday < 10) {
      $myday = "_$thisday";
    }

if ($thisday > 9) {
      $myday = "_$thisday";
    }

$date ="$thisdayofweek,$thisday/$thismonth/$thisyear";
$end ="a.log";

# process data for GA Lookup

# step 1 Home page
# step 2 Search
# step 3 Evaluator

# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/GALookup-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";


# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_DNB_GA_Lookup_eval.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[15]);
    $step2 = convert_time(@field[16]);
    $step3 = convert_time(@field[17]);
       
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[19]);
    			$step2  = convert_time(@field[20]);
   			$step3  = convert_time(@field[21]);
		 $total = ($step1 + $step2 + $step3 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[21]);
    			$step2 = convert_time(@field[22]);
   			$step3 = convert_time(@field[23]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unauthorized.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[21]);
    			$step2 = convert_time(@field[22]);
   			$step3 = convert_time(@field[23]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of Main subroutine
# End of processing for Global Access lookup
#

# process data for ICE Proxy search

# step 1 Home page
# step 2 Ice proxy search
# step 3 search

# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/ICEProxy-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";


# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_DNB_ICE_Prox_search.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[15]);
    $step2 = convert_time(@field[16]);
    $step3 = convert_time(@field[17]);
       
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[19]);
    			$step2  = convert_time(@field[20]);
   			$step3  = convert_time(@field[21]);
		 $total = ($step1 + $step2 + $step3 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[21]);
    			$step2 = convert_time(@field[22]);
   			$step3 = convert_time(@field[23]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of Main subroutine
# End of processing for ICE Proxy search
#

# process data for Login and Logout
# step 1 Home page
# step 2 Link to Login page
# step 3 Login
# step 4 Logout

# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/Loginout-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";


# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_Login_Logout.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[15]);
    $step2 = convert_time(@field[16]);
    $step3 = convert_time(@field[17]);
    $step4 = convert_time(@field[18]);	
       
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[19]);
    			$step2  = convert_time(@field[20]);
   			$step3  = convert_time(@field[21]);
			$step4  = convert_time(@field[22]);
		 $total = ($step1 + $step2 + $step3 + $step4 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[21]);
    			$step2 = convert_time(@field[22]);
   			$step3 = convert_time(@field[23]);
			$step4  = convert_time(@field[24]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$step4  = convert_time(@field[22]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$step4  = convert_time(@field[20]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$step4  = convert_time(@field[22]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$step4  = convert_time(@field[20]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of Main subroutine
# End of processing for Login and Logout
#

# process data for ICE IND search
# step 1 Home page
# step 2 Login
# step 3 Logout

# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/ICEInd-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";


# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_DNB_ICE_Ind_Search.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[15]);
    $step2 = convert_time(@field[16]);
    $step3 = convert_time(@field[17]);
       
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[19]);
    			$step2  = convert_time(@field[20]);
   			$step3  = convert_time(@field[21]);
		 $total = ($step1 + $step2 + $step3 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[21]);
    			$step2 = convert_time(@field[22]);
   			$step3 = convert_time(@field[23]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of Main subroutine
# End of processing for ICE ind Search
#
# process data for Buisness Centre


# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/BusinessCenter-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";

# process data for Verisgn secure URL monitor
# step 1 dns
# step 2 response
# step 3 download
# step 4 connect

# 3 error columns
# unable to connect
# timeout
# server error 

# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_My_Business_Center.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[14]);
    $step2 = convert_time(@field[15]);
    $step3 = convert_time(@field[16]);
    $step4 = convert_time(@field[17]);
    
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[18]);
    			$step2  = convert_time(@field[19]);
   			$step3  = convert_time(@field[20]);
			$step4  = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 + $step4 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[20]);
    			$step2 = convert_time(@field[21]);
   			$step3 = convert_time(@field[22]);
			$step4 = convert_time(@field[23]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	
if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[18]);
    			$step2 = convert_time(@field[19]);
   			$step3 = convert_time(@field[20]);
			$step4 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match error.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[16]);
    			$step2 = convert_time(@field[17]);
   			$step3 = convert_time(@field[18]);
			$step4 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[18]);
    			$step2 = convert_time(@field[19]);
   			$step3 = convert_time(@field[20]);
			$step4 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[16]);
    			$step2 = convert_time(@field[17]);
   			$step3 = convert_time(@field[18]);
			$step4 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of processing for Buisiness center url monitor
#
# process data for Global Access Evaluator


# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/GAEval-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";

# process data for Verisgn secure URL monitor
# step 1 dns
# step 2 response
# step 3 download
# step 4 connect

# 3 error columns
# unable to connect
# timeout
# server error 

# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_GA_eValuator.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[14]);
    $step2 = convert_time(@field[15]);
    $step3 = convert_time(@field[16]);
    $step4 = convert_time(@field[17]);
    
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[19]);
    			$step2  = convert_time(@field[20]);
   			$step3  = convert_time(@field[21]);
			$step4  = convert_time(@field[22]);
			$total = ($step1 + $step2 + $step3 + $step4 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[21]);
    			$step2 = convert_time(@field[22]);
   			$step3 = convert_time(@field[23]);
			$step4 = convert_time(@field[24]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	
if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$step4 = convert_time(@field[22]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match error.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$step4 = convert_time(@field[20]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[19]);
    			$step2 = convert_time(@field[20]);
   			$step3 = convert_time(@field[21]);
			$step4 = convert_time(@field[22]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[17]);
    			$step2 = convert_time(@field[18]);
   			$step3 = convert_time(@field[19]);
			$step4 = convert_time(@field[20]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of processing for GA Evaluator url monitor
#
# process data for Telebase


# Figure out the input file name and open it
#
$in_file = "$LOGDIR/SiteScope$thisyear$mymonth$myday.log";
open (INPUT, $in_file)
    || die "Can't open input file $in_file : $!\n";

# Figure out the output file name and open it
#
$suffix=".csv";
$out_file = "$OUTDIR/Telebase-$thisyear$thismonth$thisday$suffix";
open (OUTPUT, ">$out_file") 
    || die "Can't open output file $out_file : $!\n";

# process data for Verisgn secure URL monitor
# step 1 dns
# step 2 response
# step 3 download
# step 4 connect

# 3 error columns
# unable to connect
# timeout
# server error 

# Start to process the input file
#
while ($line = <INPUT>) {
   if ($line =~ /.*BOS_Telebase_Ping.*/) {
    @field = split(/ +|	|\|/, $line);
    $testtime = substr(@field[0],0,5);
    $testdate = @field[1];
    $status = @field[2];
    $testname = @field[4];

    $step1 = convert_time(@field[14]);
    $step2 = convert_time(@field[15]);
    $step3 = convert_time(@field[16]);
    $step4 = convert_time(@field[17]);
    
    if ($line =~ /.*error.*/) {
	if ($line !~ /.*disabled.*/) {
    print (OUTPUT "$date,$testtime,");
	if ($line =~ /.*timed.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1  = convert_time(@field[18]);
    			$step2  = convert_time(@field[19]);
   			$step3  = convert_time(@field[20]);
			$step4  = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 + $step4 );
 print (OUTPUT "$noerr,$err,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*unable.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[20]);
    			$step2 = convert_time(@field[21]);
   			$step3 = convert_time(@field[22]);
			$step4 = convert_time(@field[23]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$err,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	
if ($line =~ /.*content element.*/) {
		@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[18]);
    			$step2 = convert_time(@field[19]);
   			$step3 = convert_time(@field[20]);
			$step4 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*content match error.*/) {
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$blank,$blank,$blank,$blank,$blank");
    print (OUTPUT "\n");
				}
	if ($line =~ /.*server error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[16]);
    			$step2 = convert_time(@field[17]);
   			$step3 = convert_time(@field[18]);
			$step4 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*content error.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[18]);
    			$step2 = convert_time(@field[19]);
   			$step3 = convert_time(@field[20]);
			$step4 = convert_time(@field[21]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}

	if ($line =~ /.*server busy.*/) {
			@myfield = split(/ +|	|\|/, $line);
			$step1 = convert_time(@field[16]);
    			$step2 = convert_time(@field[17]);
   			$step3 = convert_time(@field[18]);
			$step4 = convert_time(@field[19]);
			$total = ($step1 + $step2 + $step3 + $step4 );
		print (OUTPUT "$noerr,$noerr,$err,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
				}
		}
    }
			
    if ($line =~ /.*warning.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }

    if ($line =~ /.*good.*/) {
    print (OUTPUT "$date,$testtime,");
	$total = ($step1 + $step2 + $step3 + $step4 );
                print (OUTPUT "$noerr,$noerr,$noerr,,,,,,,,$total,$step1,$step2,$step3,$step4");
    print (OUTPUT "\n");
			
    }
	
    }
  
}

# Close our files
#        
close OUTPUT
  || die "Can't close output file: $!\n";

close INPUT
  || die "Can't close input: $!\n";

# End of processing for Telebase url monitor
#
# time conversion routine  
sub convert_time {
  $time_left = shift (@_);

  #Convert to hours, minutes, seconds, milliseconds

  $time_hr = int($time_left/3600000);
  $time_left = $time_left - ($time_hr*3600000);
  $time_min = int($time_left/60000);
  $time_left = $time_left - ($time_min*60000);
  $time_sec = int($time_left/1000);
  $time_left= $time_left - ($time_sec*1000);
  $time_ms = $time_left;
  $time_sec = $time_sec + (60*$time_min);

  #Pad with Zeros

  $time_hr = "0" x (2-length($time_hr)) . $time_hr;
  $time_min = "0" x (2-length($time_min)) . $time_min;
  $time_sec = "0" x (2-length($time_sec)) . $time_sec;
  $time_ms = "0" x (3-length($time_ms)) . $time_ms;

  return("$time_sec.$time_ms");
}
# End of convert_time subroutine

__END__
:endofperl                              z

