From 86251b8a014583a39e365cf67c6db80197cdc608 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Tue, 23 Jul 2013 17:05:32 -0600 Subject: [PATCH 26/28] Ticket #47501 logconv.pl uses /var/tmp for BDB temp files https://fedorahosted.org/389/ticket/47501 Reviewed by: mreynolds (Thanks!) Branch: master Fix Description: Tied arrays with DB_RECNO require a backing text file. By default this goes in /var/tmp. This can be controlled with RECNOINFO bfname. However, the use of arrays was killing performance. This patch replaces all arrays with tied hashes. In addition, this patch fixes the notes=U handling to also handle notes=U,P and notes=A,P Platforms tested: RHEL6 x86_64 Flag Day: no Doc impact: no (cherry picked from commit 4d20922423c9e22c858e0be7dd317591631cf357) (cherry picked from commit d890e65b4ab15d0a836dbb248da8606867938630) --- ldap/admin/src/logconv.pl | 775 +++++++++++++++++++-------------------------- 1 files changed, 333 insertions(+), 442 deletions(-) diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl index 3a6fa01..ca07a3a 100755 --- a/ldap/admin/src/logconv.pl +++ b/ldap/admin/src/logconv.pl @@ -67,7 +67,7 @@ if ($#ARGV < 0){; my $file_count = 0; my $arg_count = 0; -my $logversion = "7.0"; +my $logversion = "8.0"; my $sizeCount = "20"; my $startFlag = 0; my $startTime = 0; @@ -76,6 +76,8 @@ my $endTime = 0; my $reportStats = ""; my $dataLocation = "/tmp"; my $startTLSoid = "1.3.6.1.4.1.1466.20037"; +my @statnames=qw(last last_str results srch add mod modrdn moddn cmp del abandon + conns sslconns bind anonbind unbind notesA notesU etime); my $s_stats = new_stats_block( ); my $m_stats = new_stats_block( ); my $verb = "no"; @@ -95,8 +97,6 @@ my %connList; my %bindReport; my @vlvconn; my @vlvop; -my @start_time_of_connection; -my @end_time_of_connection; my @fds; my $fdds = 0; my $reportBinds = "no"; @@ -179,7 +179,7 @@ if ($sizeCount eq "all"){$sizeCount = "100000";} ####################################### # # -# Initialize Arrays and variables # +# Initialize Hashes and variables # # # ####################################### @@ -255,21 +255,17 @@ map {$conn{$_} = $_} @conncodes; # hash db-backed hashes my @hashnames = qw(attr rc src rsrc excount conn_hash ip_hash conncount nentries - filter base ds6xbadpwd saslmech bindlist etime oid); + filter base ds6xbadpwd saslmech bindlist etime oid + start_time_of_connection end_time_of_connection + notesa_conn_op notesu_conn_op etime_conn_op nentries_conn_op + optype_conn_op time_conn_op srch_conn_op del_conn_op mod_conn_op + mdn_conn_op cmp_conn_op bind_conn_op unbind_conn_op ext_conn_op + abandon_conn_op badpwd_conn_op); # need per connection code ip address counts - so use a hash table # for each connection code - key is ip, val is count push @hashnames, @conncodes; my $hashes = openHashFiles($dataLocation, @hashnames); -# recno db-backed arrays/lists -my @arraynames = qw(srchconn srchop delconn delop modconn modop addconn addop modrdnconn modrdnop - cmpconn cmpop targetconn targetop msgid bindconn bindop binddn unbindconn unbindop - extconn extop notesAetime notesAconn notesAop notesAtime notesAnentries - notesUetime notesUconn notesUop notesUtime notesUnentries badpwdconn - badpwdop badpwdip baseval baseconn baseop scopeval scopeconn scopeop - filterval filterconn filterop); -my $arrays = openArrayFiles($dataLocation, @arraynames); - $needCleanup = 1; my @err; @@ -636,6 +632,12 @@ Binds: @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< . write STDOUT; +# format/write messes up emacs autoformatting - inserting this dummy function +# fixes that +sub dummy { + my $bar = shift; +} + print "\n"; print "Proxied Auth Operations: $proxiedAuthCount\n"; print "Persistent Searches: $persistentSrchCount\n"; @@ -658,115 +660,75 @@ print "Unindexed Components: $unindexedSrchCountNotesU\n"; if ($verb eq "yes" || $usage =~ /u/){ if ($unindexedSrchCountNotesA > 0){ my $conn_hash = $hashes->{conn_hash}; - my $notesConn = $arrays->{notesAconn}; - my $notesOp = $arrays->{notesAop}; - my $notesEtime = $arrays->{notesAetime}; - my $notesTime = $arrays->{notesAtime}; - my $notesNentries = $arrays->{notesAnentries}; - my $base_val = $arrays->{baseval}; - my $base_conn = $arrays->{baseconn}; - my $base_op = $arrays->{baseop}; - my $scope_val = $arrays->{scopeval}; - my $scope_conn = $arrays->{scopeconn}; - my $scope_op = $arrays->{scopeop}; - my $filter_val = $arrays->{filterval}; - my $filter_conn = $arrays->{filterconn}; - my $filter_op = $arrays->{filterop}; - my $notesCount = "1"; + my $notesa_conn_op = $hashes->{notesa_conn_op}; + my $time_conn_op = $hashes->{time_conn_op}; + my $etime_conn_op = $hashes->{etime_conn_op}; + my $nentries_conn_op = $hashes->{nentries_conn_op}; + my $base_conn_op = $hashes->{base_conn_op}; + my $scope_conn_op = $hashes->{scope_conn_op}; + my $filter_conn_op = $hashes->{filter_conn_op}; + + my $notesCount = 1; my $unindexedIp; - - for (my $n = 0; $n < scalar(@{$notesEtime}); $n++){ - if(!$notesConn->[$n] || $notesConn->[$n] eq "" || - !$conn_hash->{$notesConn->[$n]} || $conn_hash->{$notesConn->[$n]} eq ""){ - $unindexedIp = "?"; + while (my ($conn_op, $count) = each %{$notesa_conn_op}) { + my ($conn, $op) = split(",", $conn_op); + if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) { + $unindexedIp = $conn_hash->{$conn}; } else { - $unindexedIp = $conn_hash->{$notesConn->[$n]}; + $unindexedIp = "?"; } - print "\n Unindexed Search #".$notesCount."\n"; $notesCount++; - print " - Date/Time: $notesTime->[$n]\n"; - print " - Connection Number: $notesConn->[$n]\n"; - print " - Operation Number: $notesOp->[$n]\n"; - print " - Etime: $notesEtime->[$n]\n"; - print " - Nentries: $notesNentries->[$n]\n"; + print "\n Unindexed Components #".$notesCount."\n"; $notesCount++; + print " - Date/Time: $time_conn_op->{$conn_op}\n"; + print " - Connection Number: $conn\n"; + print " - Operation Number: $op\n"; + print " - Etime: $etime_conn_op->{$conn_op}\n"; + print " - Nentries: $nentries_conn_op->{$conn_op}\n"; print " - IP Address: $unindexedIp\n"; - - for (my $nnn = 0; $nnn < $baseCount; $nnn++){ - if(!$base_conn->[$nnn] || !$base_op->[$nnn]){ next; } - if ($notesConn->[$n] eq $base_conn->[$nnn] && $notesOp->[$n] eq $base_op->[$nnn]){ - print " - Search Base: $base_val->[$nnn]\n"; - last; - } + if (exists($base_conn_op->{$conn_op}) && defined($base_conn_op->{$conn_op})) { + print " - Search Base: $base_conn_op->{$conn_op}\n"; } - for (my $nnn = 0; $nnn < $scopeCount; $nnn++){ - if(!$scope_conn->[$nnn] || !$scope_op->[$nnn]){ next; } - if ($notesConn->[$n] eq $scope_conn->[$nnn] && $notesOp->[$n] eq $scope_op->[$nnn]){ - print " - Search Scope: $scope_val->[$nnn]\n"; - last; - } + if (exists($scope_conn_op->{$conn_op}) && defined($scope_conn_op->{$conn_op})) { + print " - Search Scope: $scope_conn_op->{$conn_op}\n"; } - for (my $nnn = 0; $nnn < $filterCount; $nnn++){ - if(!$filter_conn->[$nnn] || !$filter_op->[$nnn]){ next; } - if ($notesConn->[$n] eq $filter_conn->[$nnn] && $notesOp->[$n] eq $filter_op->[$nnn]){ - print " - Search Filter: $filter_val->[$nnn]\n"; - last; - } + if (exists($filter_conn_op->{$conn_op}) && defined($filter_conn_op->{$conn_op})) { + print " - Search Filter: $filter_conn_op->{$conn_op}\n"; } } } if ($unindexedSrchCountNotesU > 0){ my $conn_hash = $hashes->{conn_hash}; - my $notesConn = $arrays->{notesUconn}; - my $notesOp = $arrays->{notesUop}; - my $notesEtime = $arrays->{notesUetime}; - my $notesTime = $arrays->{notesUtime}; - my $notesNentries = $arrays->{notesUnentries}; - my $base_val = $arrays->{baseval}; - my $base_conn = $arrays->{baseconn}; - my $base_op = $arrays->{baseop}; - my $scope_val = $arrays->{scopeval}; - my $scope_conn = $arrays->{scopeconn}; - my $scope_op = $arrays->{scopeop}; - my $filter_val = $arrays->{filterval}; - my $filter_conn = $arrays->{filterconn}; - my $filter_op = $arrays->{filterop}; - - my $notesCount = "1"; + my $notesu_conn_op = $hashes->{notesu_conn_op}; + my $time_conn_op = $hashes->{time_conn_op}; + my $etime_conn_op = $hashes->{etime_conn_op}; + my $nentries_conn_op = $hashes->{nentries_conn_op}; + my $base_conn_op = $hashes->{base_conn_op}; + my $scope_conn_op = $hashes->{scope_conn_op}; + my $filter_conn_op = $hashes->{filter_conn_op}; + + my $notesCount = 1; my $unindexedIp; - for (my $n = 0; $n < scalar(@{$notesEtime}); $n++){ - if(!$notesConn->[$n] || $notesConn->[$n] eq "" || - !$conn_hash->{$notesConn->[$n]} || $conn_hash->{$notesConn->[$n]} eq ""){ - $unindexedIp = "?"; + while (my ($conn_op, $count) = each %{$notesu_conn_op}) { + my ($conn, $op) = split(",", $conn_op); + if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) { + $unindexedIp = $conn_hash->{$conn}; } else { - $unindexedIp = $conn_hash->{$notesConn->[$n]}; + $unindexedIp = "?"; } print "\n Unindexed Components #".$notesCount."\n"; $notesCount++; - print " - Date/Time: $notesTime->[$n]\n"; - print " - Connection Number: $notesConn->[$n]\n"; - print " - Operation Number: $notesOp->[$n]\n"; - print " - Etime: $notesEtime->[$n]\n"; - print " - Nentries: $notesNentries->[$n]\n"; + print " - Date/Time: $time_conn_op->{$conn_op}\n"; + print " - Connection Number: $conn\n"; + print " - Operation Number: $op\n"; + print " - Etime: $etime_conn_op->{$conn_op}\n"; + print " - Nentries: $nentries_conn_op->{$conn_op}\n"; print " - IP Address: $unindexedIp\n"; - - for (my $nnn = 0; $nnn < $baseCount; $nnn++){ - if(!$base_conn->[$nnn] || !$base_op->[$nnn]){ next; } - if ($notesConn->[$n] eq $base_conn->[$nnn] && $notesOp->[$n] eq $base_op->[$nnn]){ - print " - Search Base: $base_val->[$nnn]\n"; - last; - } + if (exists($base_conn_op->{$conn_op}) && defined($base_conn_op->{$conn_op})) { + print " - Search Base: $base_conn_op->{$conn_op}\n"; } - for (my $nnn = 0; $nnn < $scopeCount; $nnn++){ - if(!$scope_conn->[$nnn] || !$scope_op->[$nnn]){ next; } - if ($notesConn->[$n] eq $scope_conn->[$nnn] && $notesOp->[$n] eq $scope_op->[$nnn]){ - print " - Search Scope: $scope_val->[$nnn]\n"; - last; - } + if (exists($scope_conn_op->{$conn_op}) && defined($scope_conn_op->{$conn_op})) { + print " - Search Scope: $scope_conn_op->{$conn_op}\n"; } - for (my $nnn = 0; $nnn < $filterCount; $nnn++){ - if(!$filter_conn->[$nnn] || !$filter_op->[$nnn]){ next; } - if ($notesConn->[$n] eq $filter_conn->[$nnn] && $notesOp->[$n] eq $filter_op->[$nnn]){ - print " - Search Filter: $filter_val->[$nnn]\n"; - last; - } + if (exists($filter_conn_op->{$conn_op}) && defined($filter_conn_op->{$conn_op})) { + print " - Search Filter: $filter_conn_op->{$conn_op}\n"; } } } @@ -800,7 +762,7 @@ if ($connResetByPeerCount > 0){ push @retext, sprintf " - %-4s (%2s) %-40s\n",$src->{$key},$conn{$key},$connmsg{$key}; } } - print @retext; + print @retext; print "\n"; } @@ -813,8 +775,8 @@ if ($resourceUnavailCount > 0){ if ($conn{$key} eq ""){$conn{$key} = "**Resource Issue**";} push @rtext, sprintf " - %-4s (%2s) %-40s\n",$rsrc->{$key},$conn{$key},$connmsg{$key}; } - } - print @rtext; + } + print @rtext; } print "Max BER Size Exceeded: $maxBerSizeCount\n"; print "\n"; @@ -829,7 +791,7 @@ print " - SASL Binds: $saslBindCount\n"; if ($saslBindCount > 0){ my $saslmech = $hashes->{saslmech}; foreach my $saslb ( sort {$saslmech->{$b} <=> $saslmech->{$a} } (keys %{$saslmech}) ){ - printf " %-4s %-12s\n",$saslmech->{$saslb}, $saslb; + printf " %-4s %-12s\n",$saslmech->{$saslb}, $saslb; } } @@ -914,13 +876,13 @@ if ($usage =~ /e/i || $verb eq "yes"){ for (my $i = 0; $i <= $#errtext; $i++){ $errtext[$i] =~ s/\n//g; print "\n" . $errtext[$i]; - } + } } #################################### -# # +# # # Print Failed Logins # -# # +# # #################################### if ($verb eq "yes" || $usage =~ /f/ ){ @@ -936,19 +898,20 @@ if ($verb eq "yes" || $usage =~ /f/ ){ $ds6loop++; } } else { - my $bindVal = $arrays->{binddn}; - my $bindConn = $arrays->{bindconn}; - my $bindOp = $arrays->{bindop}; - my $badPasswordConn = $arrays->{badpwdconn}; - my $badPasswordOp = $arrays->{badpwdop}; - my $badPasswordIp = $arrays->{badpwdip}; + # key is conn,op - val is binddn + my $bind_conn_op = $hashes->{bind_conn_op}; + # key is conn,op - val is count + my $badpwd_conn_op = $hashes->{badpwd_conn_op}; + # key is binddn - val is count my %badPassword = (); - for (my $ii =0 ; $ii < $badPwdCount; $ii++){ - for (my $i = 0; $i < $bindCount; $i++){ - if ($badPasswordConn->[$ii] eq $bindConn->[$i] && $badPasswordOp->[$ii] eq $bindOp->[$i] ){ - $badPassword{ $bindVal->[$i] }++; - } - } + my @badPasswordIp = (); + while (my ($conn_op, $count) = each %{$badpwd_conn_op}) { + my ($conn, $op) = split(",", $conn_op); + if (exists($bind_conn_op->{$conn_op}) && defined($bind_conn_op->{$conn_op})) { + my $binddn = $bind_conn_op->{$conn_op}; + $badPassword{$binddn}++; + push @badPasswordIp, getIPfromConn($conn); + } } # sort the new hash of $badPassword{} my $bpTotal = 0; @@ -961,7 +924,7 @@ if ($verb eq "yes" || $usage =~ /f/ ){ } print "\nFrom the IP address(s) :\n\n"; for (my $i=0; $i<$badPwdCount; $i++) { - print "\t\t$badPasswordIp->[$i]\n"; + print "\t\t$badPasswordIp[$i]\n"; } if ($bpTotal > $badPwdCount){ print "\n** Warning : Wrongly reported failed login attempts : ". ($bpTotal - $badPwdCount) . "\n"; @@ -982,11 +945,11 @@ if ($connCodeCount > 0){ print "\n\n----- Total Connection Codes -----\n\n"; my $conncount = $hashes->{conncount}; my @conntext; - foreach my $key (sort { $conncount->{$b} <=> $conncount->{$a} } keys %{$conncount}) { - if ($conncount->{$key} > 0){ + foreach my $key (sort { $conncount->{$b} <=> $conncount->{$a} } keys %{$conncount}) { + if ($conncount->{$key} > 0){ push @conntext, sprintf "%-4s %6s %-40s\n",$key,$conncount->{$key},$connmsg{ $key }; - } - } + } + } print @conntext; } } @@ -1005,8 +968,8 @@ if ($usage =~ /i/i || $verb eq "yes"){ my $ip_count = ($#ipkeys + 1)-($#exxCount + 1); my $ccount = 0; if ($ip_count > 0){ - print "\n\n----- Top $sizeCount Clients -----\n\n"; - print "Number of Clients: $ip_count\n\n"; + print "\n\n----- Top $sizeCount Clients -----\n\n"; + print "Number of Clients: $ip_count\n\n"; foreach my $key (sort { $ip_hash->{$b} <=> $ip_hash->{$a} } @ipkeys) { my $exc = "no"; if ($ccount > $sizeCount){ last;} @@ -1021,7 +984,7 @@ if ($usage =~ /i/i || $verb eq "yes"){ my %counts; map { $counts{$_} = $hashes->{$_}->{$key} if (defined($hashes->{$_}->{$key})) } @conncodes; foreach my $code (sort { $counts{$b} <=> $counts{$a} } keys %counts) { - if ($code eq 'count' ) { next; } + if ($code eq 'count' ) { next; } printf "%10s - %s (%s)\n", $counts{ $code }, $code, $connmsg{ $code }; } print "\n"; @@ -1042,14 +1005,14 @@ if ($usage =~ /b/i || $verb eq "yes"){ my $bind_count = $#bindkeys + 1; if ($bind_count > 0){ print "\n\n----- Top $sizeCount Bind DN's -----\n\n"; - print "Number of Unique Bind DN's: $bind_count\n\n"; + print "Number of Unique Bind DN's: $bind_count\n\n"; my $bindcount = 0; foreach my $dn (sort { $bindlist->{$b} <=> $bindlist->{$a} } @bindkeys) { - if ($bindcount < $sizeCount){ + if ($bindcount < $sizeCount){ printf "%-8s %-40s\n", $bindlist->{ $dn },$dn; } else { - last; - } + last; + } $bindcount++; } } @@ -1070,16 +1033,16 @@ if ($usage =~ /a/i || $verb eq "yes"){ print "Number of Unique Search Bases: $base_count\n\n"; my $basecount = 0; foreach my $bas (sort { $base->{$b} <=> $base->{$a} } @basekeys) { - if ($basecount < $sizeCount){ - printf "%-8s %-40s\n", $base->{ $bas },$bas; - } else { - last; - } - $basecount++; + if ($basecount < $sizeCount){ + printf "%-8s %-40s\n", $base->{ $bas },$bas; + } else { + last; + } + $basecount++; } } } - + ######################################### # # # Gather and process search filters # @@ -1091,15 +1054,15 @@ if ($usage =~ /l/ || $verb eq "yes"){ my @filterkeys = keys %{$filter}; my $filter_count = $#filterkeys + 1; if ($filter_count > 0){ - print "\n\n----- Top $sizeCount Search Filters -----\n"; + print "\n\n----- Top $sizeCount Search Filters -----\n"; print "\nNumber of Unique Search Filters: $filter_count\n\n"; my $filtercount = 0; foreach my $filt (sort { $filter->{$b} <=> $filter->{$a} } @filterkeys){ if ($filtercount < $sizeCount){ printf "%-8s %-40s\n", $filter->{$filt}, $filt; } else { - last; - } + last; + } $filtercount++; } } @@ -1108,7 +1071,7 @@ if ($usage =~ /l/ || $verb eq "yes"){ ######################################### # # # Gather and Process the unique etimes # -# # +# # ######################################### my $first; @@ -1139,7 +1102,7 @@ if ($usage =~ /t/i || $verb eq "yes"){ if ($eloop == $sizeCount) { last; } printf "%-12s %-10s\n","etime=$et",$etime->{ $et }; $eloop++; - } + } } ####################################### @@ -1156,7 +1119,7 @@ if ($usage =~ /n/i || $verb eq "yes"){ my $eloop = 0; foreach my $nentry (sort { $b <=> $a } @nkeys){ if ($eloop == $sizeCount) { last; } - printf "%-18s %12s\n","nentries=$nentry", $nentries->{ $nentry }; + printf "%-18s %12s\n","nentries=$nentry", $nentries->{ $nentry }; $eloop++; } print "\n\n----- Top $sizeCount Most returned nentries -----\n\n"; @@ -1216,7 +1179,7 @@ if ($usage =~ /x/i || $verb eq "yes"){ } ############################################ -# # +# # # Print most commonly requested attributes # # # ############################################ @@ -1235,7 +1198,7 @@ if ($usage =~ /r/i || $verb eq "yes"){ } ############################# -# # +# # # abandoned operation stats # # # ############################# @@ -1244,66 +1207,49 @@ if ($usage =~ /g/i || $verb eq "yes"){ my $abandonTotal = $srchCount + $delCount + $modCount + $addCount + $modrdnCount + $bindCount + $extopCount + $cmpCount; if ($verb eq "yes" && $abandonCount > 0 && $abandonTotal > 0){ my $conn_hash = $hashes->{conn_hash}; + my $abandon_conn_op = $hashes->{abandon_conn_op}; + my $srch_conn_op = $hashes->{srch_conn_op}; + my $del_conn_op = $hashes->{del_conn_op}; + my $add_conn_op = $hashes->{add_conn_op}; + my $mod_conn_op = $hashes->{mod_conn_op}; + my $cmp_conn_op = $hashes->{cmp_conn_op}; + my $mdn_conn_op = $hashes->{mdn_conn_op}; + my $bind_conn_op = $hashes->{bind_conn_op}; + my $unbind_conn_op = $hashes->{unbind_conn_op}; + my $ext_conn_op = $hashes->{ext_conn_op}; print "\n\n----- Abandon Request Stats -----\n\n"; - for (my $g = 0; $g < $abandonCount; $g++){ - my $conn = $arrays->{targetconn}->[$g]; - my $op = $arrays->{targetop}->[$g]; - my $msgid = $arrays->{msgid}->[$g]; - for (my $sc = 0; $sc < $srchCount; $sc++){ - if (($arrays->{srchconn}->[$sc] && $arrays->{srchop}->[$sc]) && - ($arrays->{srchconn}->[$sc] eq $conn && $arrays->{srchop}->[$sc] eq $op )){ - print " - SRCH conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $dc = 0; $dc < $delCount; $dc++){ - if (($arrays->{delconn}->[$dc] && $arrays->{delop}->[$dc]) && - ($arrays->{delconn}->[$dc] eq $conn && $arrays->{delop}->[$dc] eq $op)){ - print " - DEL conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $adc = 0; $adc < $addCount; $adc++){ - if (($arrays->{addconn}->[$adc] && $arrays->{addop}->[$adc]) && - ($arrays->{addconn}->[$adc] eq $conn && $arrays->{addop}->[$adc] eq $op)){ - print " - ADD conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $mc = 0; $mc < $modCount; $mc++){ - if (($arrays->{modconn}->[$mc] && $arrays->{modop}->[$mc]) && - ($arrays->{modconn}->[$mc] eq $conn && $arrays->{modop}->[$mc] eq $op)){ - print " - MOD conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $cc = 0; $cc < $cmpCount; $cc++){ - if (($arrays->{cmpconn}->[$cc] && $arrays->{cmpop}->[$cc]) && - ($arrays->{cmpconn}->[$cc] eq $conn && $arrays->{cmpop}->[$cc] eq $op)){ - print " - CMP conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $mdc = 0; $mdc < $modrdnCount; $mdc++){ - if (($arrays->{modrdnconn}->[$mdc] && $arrays->{modrdnop}->[$mdc]) && - ($arrays->{modrdnconn}->[$mdc] eq $conn && $arrays->{modrdnop}->[$mdc] eq $op)){ - print " - MODRDN conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $bcb = 0; $bcb < $bindCount; $bcb++){ - if (($arrays->{bindconn}->[$bcb] && $arrays->{bindop}->[$bcb]) && - ($arrays->{bindconn}->[$bcb] eq $conn && $arrays->{bindop}->[$bcb] eq $op)){ - print " - BIND conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } - } - for (my $ubc = 0; $ubc < $unbindCount; $ubc++){ - if (($arrays->{unbindconn}->[$ubc] && $arrays->{unbindop}->[$ubc]) && - ($arrays->{unbindconn}->[$ubc] eq $conn && $arrays->{unbindop}->[$ubc] eq $op)){ - print " - UNBIND conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } + while (my ($conn_op, $targ_msgid) = each %{$abandon_conn_op}) { + my ($conn, $op) = split(",", $conn_op); + my ($targetop, $msgid) = split(",", $targ_msgid); + my $conn_targ = "$conn,$targetop"; + my $clientIP; + if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) { + $clientIP = $conn_hash->{$conn}; + } else { + $clientIP = "Unknown"; } - for (my $ec = 0; $ec < $extopCount; $ec++){ - if (($arrays->{extconn}->[$ec] && $arrays->{extop}->[$ec]) && - ($arrays->{extconn}->[$ec] eq $conn && $arrays->{extop}->[$ec] eq $op)){ - print " - EXT conn=$conn op=$op msgid=$msgid client=$conn_hash->{$conn}\n"; - } + if (exists($srch_conn_op->{$conn_targ}) && defined($srch_conn_op->{$conn_targ})) { + print " - SRCH conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($del_conn_op->{$conn_targ}) && defined($del_conn_op->{$conn_targ})) { + print " - DEL conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($add_conn_op->{$conn_targ}) && defined($add_conn_op->{$conn_targ})) { + print " - ADD conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($mod_conn_op->{$conn_targ}) && defined($mod_conn_op->{$conn_targ})) { + print " - MOD conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($cmp_conn_op->{$conn_targ}) && defined($cmp_conn_op->{$conn_targ})) { + print " - CMP conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($mdn_conn_op->{$conn_targ}) && defined($mdn_conn_op->{$conn_targ})) { + print " - MODRDN conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($bind_conn_op->{$conn_targ}) && defined($bind_conn_op->{$conn_targ})) { + print " - BIND conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($unbind_conn_op->{$conn_targ}) && defined($unbind_conn_op->{$conn_targ})) { + print " - UNBIND conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } elsif (exists($ext_conn_op->{$conn_targ}) && defined($ext_conn_op->{$conn_targ})) { + print " - EXT conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; + } else { + print " - UNKNOWN conn=$conn op=$targetop msgid=$msgid client=$clientIP\n"; } } } @@ -1390,8 +1336,8 @@ sub displayUsage { print "Usage:\n\n"; print " ./logconv.pl [-h] [-d|--rootdn ] [-s|--sizeLimit ] [-v|verison] [-Vi|verbose]\n"; - print " [-S|--startTime ] [-E|--endTime ] \n"; - print " [-efcibaltnxrgjuyp] [ access log ... ... ]\n\n"; + print " [-S|--startTime ] [-E|--endTime ] \n"; + print " [-efcibaltnxrgjuyp] [ access log ... ... ]\n\n"; print "- Commandline Switches:\n\n"; @@ -1400,7 +1346,7 @@ sub displayUsage { print " -D, --data default is \"/tmp\"\n"; print " -s, --sizeLimit default is 20\n"; print " -X, --excludeIP E.g. Load balancers\n"; - print " -v, --version show version of tool\n"; + print " -v, --version show version of tool\n"; print " -S, --startTime