2011-04-03 09:37:12.129 (INFO, ICELineHandler.cpp:339) Product Def MarketID 90120253, Symbol 'BRN FMU0012_OMCA0000118502081312'
2011-04-09 21:32:15.525 [3509,3523]: Gap detect on 233.156.208.41:20041 from 2746318 to 2746373, moving to next message
2011-04-09 21:32:15.585 [3509,3523]: Gap detect on 233.156.208.41:20041 from 2746420 to 2746475, moving to next message
2011-04-09 21:32:15.639 [3509,3522]: Received data on Connection[ICE-Options]. Pending=214044.
2011-04-03 09:37:12.129 (INFO, ICELineHandler.cpp:339) Product Def MarketID 90120253, Symbol 'BRN FMU0012_OMCA0000118502081312'
####
my %ICE = (
21:31:10 => [ 'Pending=3201', ],
21:32:14 => [ 'Pending=1000', ],
21:32:15 => [ 'Gap detect', '233.156.208.41:20041', 'Pending=214044',],
21:32:24 => [ 'Gap detect', '233.156.208.41:20041', 'Pending=104000',],
21:32:58 => [ 'Gap detect', '233.156.208.41:20041' 'Pending=96000',],
21:33:12 => [ 'Pending=528', ]
);
And print comma separated:
21:31:10, Gap detect 233.156.208.41:20041, Pending=
21:31:12, Gap detect 233.156.208.41:20041, Pending=3400
##
##
# Get today's date which will be used as the default.
my($day, $month, $year) = (localtime)[3,4,5];
$month = sprintf '%02d', $month+1;
$day = sprintf '%02d', $day;
$year = $year+1900;
$ymd = "$year-$month-$day";
my $total; # variable to be used for queue total for the given timeframe
my $count = 0;
## Get command line arguments, convert time to seconds
##my $logFile = "pmmd-ltc-fsrlabs21-mdrc-server-cta.log";
my $logFile = "pmmd-ltc-fsrlabs41-mdrc-server-ice.log";
my $sTime= $ARGV[0];
my @sTime=split(/:/,$sTime); # split start time
my $sSecs=$sTime[0] * 3600 + $sTime[1] * 60 + $sTime[2]; # convert start-time to seconds
my $eTime = $ARGV[1];
my @eTime=split(/:/,$eTime); # split end time
my $eSecs=$eTime[0] * 3600 + $eTime[1] * 60 + $eTime[2]; # convert stop-time to seconds
my $tHold = $ARGV[2];
open(LOG, "$logFile") or die "Couldn't open file for processing: $!";
while ( $line = ) {
unless (($data[10] =~ m/Pending=/) || ($data[6] =~ m/Gap/)) { next; } # skip elements we don't want
if ($line =~ m/Pending=/) {
my @data=split(/ /,$line); # split the line up
$data[10] =~ s/[A-Za-z=.]//g; # delete "Pending", "=" and "."
$data[1] =~ s/\..*//g; # delete the millisecond element of the (line)lTime var
my @lTime=split(/:/,$data[1]); # split the line time
my $lSecs=$lTime[0] * 3600 + $lTime[1] * 60 + $lTime[2]; # convert line-time to seconds
if (($data[0] eq $ymd) && ($data[10] >= $tHold) && ($lSecs >= $sSecs) && ($lSecs <= $eSecs))
{
$line = "$data[1],$data[10]";
}
}
elsif ($line =~ m/Gap detect/) {
my @data=split(/ /,$line); # split the line up
$data[1] =~ s/\..*//g; # delete the millisecond element of the (line)lTime var
my @lTime=split(/:/,$data[1]); # split the line time
my $lSecs=$lTime[0] * 3600 + $lTime[1] * 60 + $lTime[2]; # convert line-time to seconds
if (($data[0] eq $ymd) && ($lSecs >= $sSecs) && ($lSecs <= $eSecs))
{
$line = "$data[1],$data[9]";
}
} else { next; }
($time, $rest) = split ',', $line, 2;
#$time =~ s/\..*//g; # delete the millisecond element
@fields = split ',', $rest;
$HoA{$time} = [ @fields ];
}
for $time (sort (keys (%HoA)) ) {
print "$time: @{ $HoA{$time} }\n";
}
close LOG;