andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 158216356ae3b609248771d3acc6a5009a64a754 Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Fri, 27 Sep 2013 11:08:29 -0600
dc8c34
Subject: [PATCH 137/225] Ticket 47533 logconv: some stats do not work across
dc8c34
 server restarts
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47533
dc8c34
Reviewed by: mreynolds (Thanks!)
dc8c34
Branch: master
dc8c34
Fix Description: Most of the stat hashes use connid,opid as the hash key.
dc8c34
The connid,opid are not unique because the server recycles connection ids
dc8c34
when the server restarts.  The solution is to use a triplet of
dc8c34
$serverRestartCount,$connid,$opid
dc8c34
as the hash key.  This uniquely identifies a particular log event over
dc8c34
restarts.  There is also some additional cleanup that needs to be done when
dc8c34
the server is reset - returning fds, marking connections as closed, etc.
dc8c34
Also fixed some gmtime handling - we were doing too many conversions.
dc8c34
This fix adds another command line option - -U - for a summary of search
dc8c34
filters which are unindexed or have unindexed components.  The full detailed
dc8c34
report is just too much data.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: no
dc8c34
(cherry picked from commit 92ac8f48c1e5a8a049f4cfd1912fd570c628408f)
dc8c34
(cherry picked from commit e38685be139c2420cc969499324405a30203122a)
dc8c34
(cherry picked from commit 9103b3e3812fd2cd05f281729e017c46f1c841e5)
dc8c34
(cherry picked from commit 313dd8ecf483bda7dad774afba7d624275ab6ba1)
dc8c34
---
dc8c34
 ldap/admin/src/logconv.pl | 337 ++++++++++++++++++++++++++--------------------
dc8c34
 man/man1/logconv.pl.1     |  10 +-
dc8c34
 2 files changed, 196 insertions(+), 151 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
dc8c34
index ca07a3a..275ce34 100755
dc8c34
--- a/ldap/admin/src/logconv.pl
dc8c34
+++ b/ldap/admin/src/logconv.pl
dc8c34
@@ -86,7 +86,8 @@ my $xi = 0;
dc8c34
 my $bindReportDN;
dc8c34
 my $usage = "";
dc8c34
 my @latency;
dc8c34
-my @openConnection;
dc8c34
+# key is conn number - val is IP address
dc8c34
+my %openConnection;
dc8c34
 my @errorCode;
dc8c34
 my @errtext;
dc8c34
 my @errornum;
dc8c34
@@ -133,7 +134,8 @@ GetOptions(
dc8c34
 	'u' => sub { $usage = $usage . "u"; },
dc8c34
 	'r' => sub { $usage = $usage . "r"; },
dc8c34
 	'y' => sub { $usage = $usage . "y"; },
dc8c34
-	'p' => sub { $usage = $usage . "p"; }
dc8c34
+	'p' => sub { $usage = $usage . "p"; },
dc8c34
+	'U' => sub { $usage = $usage . "U"; }
dc8c34
 );
dc8c34
 
dc8c34
 #
dc8c34
@@ -657,7 +659,7 @@ print "Paged Searches:               $pagedSearchCount\n";
dc8c34
 print "Unindexed Searches:           $unindexedSrchCountNotesA\n";
dc8c34
 print "Unindexed Components:         $unindexedSrchCountNotesU\n";
dc8c34
 
dc8c34
-if ($verb eq "yes" || $usage =~ /u/){
dc8c34
+if ($verb eq "yes" || $usage =~ /u/ || $usage =~ /U/){
dc8c34
 	if ($unindexedSrchCountNotesA > 0){
dc8c34
 		my $conn_hash = $hashes->{conn_hash};
dc8c34
 		my $notesa_conn_op = $hashes->{notesa_conn_op};
dc8c34
@@ -670,28 +672,39 @@ if ($verb eq "yes" || $usage =~ /u/){
dc8c34
 
dc8c34
 		my $notesCount = 1;
dc8c34
 		my $unindexedIp;
dc8c34
-		while (my ($conn_op, $count) = each %{$notesa_conn_op}) {
dc8c34
-			my ($conn, $op) = split(",", $conn_op);
dc8c34
-			if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) {
dc8c34
-				$unindexedIp = $conn_hash->{$conn};
dc8c34
-			} else {
dc8c34
-				$unindexedIp = "?";
dc8c34
-			}
dc8c34
-			print "\n  Unindexed Components #".$notesCount."\n"; $notesCount++;
dc8c34
-			print "  -  Date/Time:             $time_conn_op->{$conn_op}\n";
dc8c34
-			print "  -  Connection Number:     $conn\n";
dc8c34
-			print "  -  Operation Number:      $op\n";
dc8c34
-			print "  -  Etime:                 $etime_conn_op->{$conn_op}\n";
dc8c34
-			print "  -  Nentries:              $nentries_conn_op->{$conn_op}\n";
dc8c34
-			print "  -  IP Address:            $unindexedIp\n";
dc8c34
-			if (exists($base_conn_op->{$conn_op}) && defined($base_conn_op->{$conn_op})) {
dc8c34
-				print "  -  Search Base:           $base_conn_op->{$conn_op}\n";
dc8c34
+		my %uniqFilt = (); # hash of unique filters
dc8c34
+		while (my ($srcnt_conn_op, $count) = each %{$notesa_conn_op}) {
dc8c34
+			my ($srvRstCnt, $conn, $op) = split(",", $srcnt_conn_op);
dc8c34
+			$unindexedIp = getIPfromConn($conn, $srvRstCnt);
dc8c34
+			if ($usage =~ /u/) {
dc8c34
+				print "\n  Unindexed Search #".$notesCount."\n";
dc8c34
+				print "  -  Date/Time:             $time_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				print "  -  Connection Number:     $conn\n";
dc8c34
+				print "  -  Operation Number:      $op\n";
dc8c34
+				print "  -  Etime:                 $etime_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				print "  -  Nentries:              $nentries_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				print "  -  IP Address:            $unindexedIp\n";
dc8c34
+				if (exists($base_conn_op->{$srcnt_conn_op}) && defined($base_conn_op->{$srcnt_conn_op})) {
dc8c34
+					print "  -  Search Base:           $base_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				}
dc8c34
+				if (exists($scope_conn_op->{$srcnt_conn_op}) && defined($scope_conn_op->{$srcnt_conn_op})) {
dc8c34
+					print "  -  Search Scope:          $scope_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				}
dc8c34
 			}
dc8c34
-			if (exists($scope_conn_op->{$conn_op}) && defined($scope_conn_op->{$conn_op})) {
dc8c34
-				print "  -  Search Scope:          $scope_conn_op->{$conn_op}\n";
dc8c34
+			if (exists($filter_conn_op->{$srcnt_conn_op}) && defined($filter_conn_op->{$srcnt_conn_op})) {
dc8c34
+				if ($usage =~ /u/) {
dc8c34
+					print "  -  Search Filter:         $filter_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				}
dc8c34
+				$uniqFilt{$filter_conn_op->{$srcnt_conn_op}}++;
dc8c34
 			}
dc8c34
-			if (exists($filter_conn_op->{$conn_op}) && defined($filter_conn_op->{$conn_op})) {
dc8c34
-				print "  -  Search Filter:         $filter_conn_op->{$conn_op}\n";
dc8c34
+			$notesCount++;
dc8c34
+		}
dc8c34
+		if ($usage =~ /U/) {
dc8c34
+			print "\n  Unindexed Search Summary - $notesCount total unindexed searches\n";
dc8c34
+			foreach my $key (sort { $uniqFilt{$b} <=> $uniqFilt{$a} } keys %uniqFilt) {
dc8c34
+				if ($uniqFilt{$key} > 0) {
dc8c34
+					printf "  -  Number of times used unindexed: %10d Filter: $key\n", $uniqFilt{$key};
dc8c34
+				}
dc8c34
 			}
dc8c34
 		}
dc8c34
 	}
dc8c34
@@ -707,28 +720,39 @@ if ($verb eq "yes" || $usage =~ /u/){
dc8c34
 
dc8c34
 		my $notesCount = 1;
dc8c34
 		my $unindexedIp;
dc8c34
-		while (my ($conn_op, $count) = each %{$notesu_conn_op}) {
dc8c34
-			my ($conn, $op) = split(",", $conn_op);
dc8c34
-			if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) {
dc8c34
-				$unindexedIp = $conn_hash->{$conn};
dc8c34
-			} else {
dc8c34
-				$unindexedIp = "?";
dc8c34
-			}
dc8c34
-			print "\n  Unindexed Components #".$notesCount."\n"; $notesCount++;
dc8c34
-			print "  -  Date/Time:             $time_conn_op->{$conn_op}\n";
dc8c34
-			print "  -  Connection Number:     $conn\n";
dc8c34
-			print "  -  Operation Number:      $op\n";
dc8c34
-			print "  -  Etime:                 $etime_conn_op->{$conn_op}\n";
dc8c34
-			print "  -  Nentries:              $nentries_conn_op->{$conn_op}\n";
dc8c34
-			print "  -  IP Address:            $unindexedIp\n";
dc8c34
-			if (exists($base_conn_op->{$conn_op}) && defined($base_conn_op->{$conn_op})) {
dc8c34
-				print "  -  Search Base:           $base_conn_op->{$conn_op}\n";
dc8c34
+		my %uniqFilt = (); # hash of unique filters
dc8c34
+		while (my ($srcnt_conn_op, $count) = each %{$notesu_conn_op}) {
dc8c34
+			my ($srvRstCnt, $conn, $op) = split(",", $srcnt_conn_op);
dc8c34
+			$unindexedIp = getIPfromConn($conn, $srvRstCnt);
dc8c34
+			if ($usage =~ /u/) {
dc8c34
+				print "\n  Unindexed Component #".$notesCount."\n";
dc8c34
+				print "  -  Date/Time:             $time_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				print "  -  Connection Number:     $conn\n";
dc8c34
+				print "  -  Operation Number:      $op\n";
dc8c34
+				print "  -  Etime:                 $etime_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				print "  -  Nentries:              $nentries_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				print "  -  IP Address:            $unindexedIp\n";
dc8c34
+				if (exists($base_conn_op->{$srcnt_conn_op}) && defined($base_conn_op->{$srcnt_conn_op})) {
dc8c34
+					print "  -  Search Base:           $base_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				}
dc8c34
+				if (exists($scope_conn_op->{$srcnt_conn_op}) && defined($scope_conn_op->{$srcnt_conn_op})) {
dc8c34
+					print "  -  Search Scope:          $scope_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				}
dc8c34
 			}
dc8c34
-			if (exists($scope_conn_op->{$conn_op}) && defined($scope_conn_op->{$conn_op})) {
dc8c34
-				print "  -  Search Scope:          $scope_conn_op->{$conn_op}\n";
dc8c34
+			if (exists($filter_conn_op->{$srcnt_conn_op}) && defined($filter_conn_op->{$srcnt_conn_op})) {
dc8c34
+				if ($usage =~ /u/) {
dc8c34
+					print "  -  Search Filter:         $filter_conn_op->{$srcnt_conn_op}\n";
dc8c34
+				}
dc8c34
+				$uniqFilt{$filter_conn_op->{$srcnt_conn_op}}++;
dc8c34
 			}
dc8c34
-			if (exists($filter_conn_op->{$conn_op}) && defined($filter_conn_op->{$conn_op})) {
dc8c34
-				print "  -  Search Filter:         $filter_conn_op->{$conn_op}\n";
dc8c34
+			$notesCount++;
dc8c34
+		}
dc8c34
+		if ($usage =~ /U/) {
dc8c34
+			print "\n  Unindexed Component Summary - $notesCount total unindexed components\n";
dc8c34
+			foreach my $key (sort { $uniqFilt{$b} <=> $uniqFilt{$a} } keys %uniqFilt) {
dc8c34
+				if ($uniqFilt{$key} > 0) {
dc8c34
+					printf "  -  Number of times used unindexed: %10d Filter: $key\n", $uniqFilt{$key};
dc8c34
+				}
dc8c34
 			}
dc8c34
 		}
dc8c34
 	}
dc8c34
@@ -829,12 +853,10 @@ if ($verb eq "yes" || $usage =~ /y/){
dc8c34
 ###################################
dc8c34
 
dc8c34
 if ($verb eq "yes" || $usage =~ /p/){
dc8c34
-	if (@openConnection > 0){
dc8c34
+	if (%openConnection){
dc8c34
 		print "\n\n----- Current Open Connection IDs ----- \n\n";
dc8c34
-		for (my $i=0; $i <= $#openConnection ; $i++) {
dc8c34
-			if ($openConnection[$i]) {
dc8c34
-				print "Conn Number:  $i (" . getIPfromConn($i) . ")\n";
dc8c34
-			}
dc8c34
+		while (my ($connid, $ip) = each %openConnection) {
dc8c34
+			print "Conn Number:  $connid ($ip)\n";
dc8c34
 		}
dc8c34
 	}
dc8c34
 }
dc8c34
@@ -904,13 +926,13 @@ if ($verb eq "yes" || $usage =~ /f/ ){
dc8c34
 			my $badpwd_conn_op = $hashes->{badpwd_conn_op};
dc8c34
 			# key is binddn - val is count
dc8c34
 			my %badPassword = ();
dc8c34
-			my @badPasswordIp = ();
dc8c34
-			while (my ($conn_op, $count) = each %{$badpwd_conn_op}) {
dc8c34
-				my ($conn, $op) = split(",", $conn_op);
dc8c34
-				if (exists($bind_conn_op->{$conn_op}) && defined($bind_conn_op->{$conn_op})) {
dc8c34
-					my $binddn = $bind_conn_op->{$conn_op};
dc8c34
+			my %badPasswordIp = ();
dc8c34
+			while (my ($srcnt_conn_op, $ip) = each %{$badpwd_conn_op}) {
dc8c34
+				my ($srvRstCnt, $conn, $op) = split(",", $srcnt_conn_op);
dc8c34
+				if (exists($bind_conn_op->{$srcnt_conn_op}) && defined($bind_conn_op->{$srcnt_conn_op})) {
dc8c34
+					my $binddn = $bind_conn_op->{$srcnt_conn_op};
dc8c34
 					$badPassword{$binddn}++;
dc8c34
-					push @badPasswordIp, getIPfromConn($conn);
dc8c34
+					$badPasswordIp{$ip}++;
dc8c34
 				}
dc8c34
 			}
dc8c34
 			# sort the new hash of $badPassword{}
dc8c34
@@ -923,8 +945,11 @@ if ($verb eq "yes" || $usage =~ /f/ ){
dc8c34
 				printf "%-4s        %-40s\n", $badPassword{"$badpw"}, $badpw;
dc8c34
 			}
dc8c34
 			print "\nFrom the IP address(s) :\n\n";
dc8c34
-			for (my $i=0; $i<$badPwdCount; $i++) {
dc8c34
-				print "\t\t$badPasswordIp[$i]\n";
dc8c34
+			$bpCount = 0;
dc8c34
+			foreach my $ip (sort {$badPassword{$b} <=> $badPassword{$a} } keys %badPasswordIp){
dc8c34
+				if ($bpCount > $sizeCount){ last;}
dc8c34
+				$bpCount++;
dc8c34
+				printf "%-4s        %-16s\n", $badPasswordIp{$ip}, $ip;
dc8c34
 			}
dc8c34
 			if ($bpTotal > $badPwdCount){
dc8c34
 				print "\n** Warning : Wrongly reported failed login attempts : ". ($bpTotal - $badPwdCount) . "\n";
dc8c34
@@ -1220,33 +1245,28 @@ if ($usage =~ /g/i || $verb eq "yes"){
dc8c34
 
dc8c34
 		print "\n\n----- Abandon Request Stats -----\n\n";
dc8c34
 
dc8c34
-		while (my ($conn_op, $targ_msgid) = each %{$abandon_conn_op}) {
dc8c34
-			my ($conn, $op) = split(",", $conn_op);
dc8c34
+		while (my ($srcnt_conn_op, $targ_msgid) = each %{$abandon_conn_op}) {
dc8c34
+			my ($srvRstCnt, $conn, $op) = split(",", $srcnt_conn_op);
dc8c34
 			my ($targetop, $msgid) = split(",", $targ_msgid);
dc8c34
-			my $conn_targ = "$conn,$targetop";
dc8c34
-			my $clientIP;
dc8c34
-			if (exists($conn_hash->{$conn}) && defined($conn_hash->{$conn})) {
dc8c34
-				$clientIP = $conn_hash->{$conn};
dc8c34
-			} else {
dc8c34
-				$clientIP = "Unknown";
dc8c34
-			}
dc8c34
-			if (exists($srch_conn_op->{$conn_targ}) && defined($srch_conn_op->{$conn_targ})) {
dc8c34
+			my $srcnt_conn_targ = "$srvRstCnt,$conn,$targetop";
dc8c34
+			my $clientIP = getIPfromConn($conn, $srvRstCnt);
dc8c34
+			if (exists($srch_conn_op->{$srcnt_conn_targ}) && defined($srch_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - SRCH conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($del_conn_op->{$conn_targ}) && defined($del_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($del_conn_op->{$srcnt_conn_targ}) && defined($del_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - DEL  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($add_conn_op->{$conn_targ}) && defined($add_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($add_conn_op->{$srcnt_conn_targ}) && defined($add_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - ADD  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($mod_conn_op->{$conn_targ}) && defined($mod_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($mod_conn_op->{$srcnt_conn_targ}) && defined($mod_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - MOD  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($cmp_conn_op->{$conn_targ}) && defined($cmp_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($cmp_conn_op->{$srcnt_conn_targ}) && defined($cmp_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - CMP  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($mdn_conn_op->{$conn_targ}) && defined($mdn_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($mdn_conn_op->{$srcnt_conn_targ}) && defined($mdn_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - MODRDN conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($bind_conn_op->{$conn_targ}) && defined($bind_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($bind_conn_op->{$srcnt_conn_targ}) && defined($bind_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - BIND conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($unbind_conn_op->{$conn_targ}) && defined($unbind_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($unbind_conn_op->{$srcnt_conn_targ}) && defined($unbind_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - UNBIND conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
-			} elsif (exists($ext_conn_op->{$conn_targ}) && defined($ext_conn_op->{$conn_targ})) {
dc8c34
+			} elsif (exists($ext_conn_op->{$srcnt_conn_targ}) && defined($ext_conn_op->{$srcnt_conn_targ})) {
dc8c34
 				print " - EXT  conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
 			} else {
dc8c34
 				print " - UNKNOWN conn=$conn op=$targetop msgid=$msgid client=$clientIP\n";
dc8c34
@@ -1521,6 +1541,44 @@ processOpForBindReport
dc8c34
 }
dc8c34
 
dc8c34
 my ($last_tm, $lastzone, $last_min, $gmtime, $tzoff);
dc8c34
+sub handleConnClose
dc8c34
+{
dc8c34
+	my $connID = shift;
dc8c34
+	$fdReturned++;
dc8c34
+	$simConnection--;
dc8c34
+
dc8c34
+	delete $openConnection{$connID};
dc8c34
+	if ($reportStats or ($verb eq "yes") || ($usage =~ /y/)) {
dc8c34
+		# if we didn't see the start time of this connection
dc8c34
+		# i.e. due to truncation or log rotation
dc8c34
+		# then just set to 0
dc8c34
+		my $stoc = $hashes->{start_time_of_connection}->{$connID} || 0;
dc8c34
+		$hashes->{end_time_of_connection}->{$connID} = $gmtime || 0;
dc8c34
+		my $diff = $hashes->{end_time_of_connection}->{$connID} - $stoc;
dc8c34
+		$hashes->{start_time_of_connection}->{$connID} = $hashes->{end_time_of_connection}->{$connID} = 0;
dc8c34
+		if ($diff <= 1) { $latency[0]++;}
dc8c34
+		if ($diff == 2) { $latency[1]++;}
dc8c34
+		if ($diff == 3) { $latency[2]++;}
dc8c34
+		if ($diff >= 4 && $diff <=5 ) { $latency[3]++;}
dc8c34
+		if ($diff >= 6 && $diff <=10 ) { $latency[4]++;}
dc8c34
+		if ($diff >= 11 && $diff <=15 ) { $latency[5]++;}
dc8c34
+		if ($diff >= 16) { $latency[6] ++;}
dc8c34
+	}
dc8c34
+}
dc8c34
+
dc8c34
+sub handleRestart
dc8c34
+{
dc8c34
+	# there are some stats which depend on restarts
dc8c34
+	if ($verb eq "yes") {
dc8c34
+		print "Found a restart - resetting stats that depend on restarts";
dc8c34
+	}
dc8c34
+	for my $connID (keys %openConnection) {
dc8c34
+		handleConnClose($connID);
dc8c34
+	}
dc8c34
+	%openConnection = (); # reset open connections
dc8c34
+	$serverRestartCount++;
dc8c34
+}
dc8c34
+
dc8c34
 sub parseLineNormal
dc8c34
 {
dc8c34
 	local $_ = $logline;
dc8c34
@@ -1612,42 +1670,42 @@ sub parseLineNormal
dc8c34
 			$anyAttrs++;
dc8c34
 		}
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{srch_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{srch_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ DEL/){
dc8c34
 		$delCount++;
dc8c34
 		if($reportStats){ inc_stats('del',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{del_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{del_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ MOD dn=/){
dc8c34
 		$modCount++;
dc8c34
 		if($reportStats){ inc_stats('mod',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{mod_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{mod_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ ADD/){
dc8c34
 		$addCount++;
dc8c34
 		if($reportStats){ inc_stats('add',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{add_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{add_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ MODRDN/){
dc8c34
 		$modrdnCount++;
dc8c34
 		if($reportStats){ inc_stats('modrdn',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{mdn_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{mdn_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ CMP dn=/){
dc8c34
 		$cmpCount++;
dc8c34
 		if($reportStats){ inc_stats('cmp',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"  || $usage =~ /g/i){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{cmp_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{cmp_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ ABANDON /){
dc8c34
@@ -1662,7 +1720,7 @@ sub parseLineNormal
dc8c34
 		if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+) +ABANDON +targetop= *([0-9a-zA-Z]+) +msgid= *([0-9\-]+)/i ){
dc8c34
 			# abandon_conn_op - key is the conn,op of the ABANDON request
dc8c34
 			# the value is the targetop,msgid of the ABANDON request
dc8c34
-			$hashes->{abandon_conn_op}->{"$1,$2"} = "$3,$4"; # targetop,msgid
dc8c34
+			$hashes->{abandon_conn_op}->{"$serverRestartCount,$1,$2"} = "$3,$4"; # targetop,msgid
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ VLV /){
dc8c34
@@ -1676,7 +1734,9 @@ sub parseLineNormal
dc8c34
 	if (m/ SORT /){$vlvSortCount++}
dc8c34
 	if (m/ version=2/){$v2BindCount++}
dc8c34
 	if (m/ version=3/){$v3BindCount++}
dc8c34
-	if (m/ conn=1 fd=/){$serverRestartCount++}
dc8c34
+	if (m/ conn=1 fd=/){
dc8c34
+		handleRestart();
dc8c34
+	}
dc8c34
 	if (m/ SSL connection from/){$sslCount++; if($reportStats){ inc_stats('sslconns',$s_stats,$m_stats); }}
dc8c34
 	if (m/ connection from local to /){$ldapiCount++;}
dc8c34
 	if($_ =~ /AUTOBIND dn=\"(.*)\"/){
dc8c34
@@ -1697,9 +1757,11 @@ sub parseLineNormal
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ connection from/){
dc8c34
+		my $ip;
dc8c34
 		if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ){
dc8c34
+			$ip = $1;
dc8c34
 			for (my $xxx =0; $xxx < $#excludeIP; $xxx++){
dc8c34
-				if ($excludeIP[$xxx] eq $1){$exc = "yes";}
dc8c34
+				if ($excludeIP[$xxx] eq $ip){$exc = "yes";}
dc8c34
 			}
dc8c34
 			if ($exc ne "yes"){
dc8c34
 				$connectionCount++;
dc8c34
@@ -1711,40 +1773,17 @@ sub parseLineNormal
dc8c34
 			$maxsimConnection = $simConnection;
dc8c34
 		}
dc8c34
 		($connID) = $_ =~ /conn=(\d*)\s/;
dc8c34
-		$openConnection[$connID]++;
dc8c34
+		$openConnection{$connID} = $ip;
dc8c34
 		if ($reportStats or ($verb eq "yes") || ($usage =~ /y/)) {
dc8c34
-			my ($time, $tzone) = split (' ', $_);
dc8c34
-			my ($date, $hr, $min, $sec) = split (':', $time);
dc8c34
-			my ($day, $mon, $yr) = split ('/', $date);
dc8c34
-			$day =~ s/\[//;
dc8c34
-			$hashes->{start_time_of_connection}->{$connID} = timegm($sec, $min, $hr, $day, $monthname{$mon}, $yr);
dc8c34
+			$hashes->{start_time_of_connection}->{$connID} = $gmtime;
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ SSL client bound as /){$sslClientBindCount++;}
dc8c34
 	if (m/ SSL failed to map client certificate to LDAP DN/){$sslClientFailedCount++;}
dc8c34
 	if (m/ fd=/ && m/slot=/){$fdTaken++}
dc8c34
 	if (m/ fd=/ && m/closed/){
dc8c34
-		$fdReturned++;
dc8c34
-		$simConnection--;
dc8c34
-
dc8c34
 		($connID) = $_ =~ /conn=(\d*)\s/;
dc8c34
-		$openConnection[$connID]--;
dc8c34
-		if ($reportStats or ($verb eq "yes") || ($usage =~ /y/)) {
dc8c34
-			# if we didn't see the start time of this connection
dc8c34
-			# i.e. due to truncation or log rotation
dc8c34
-			# then just set to 0
dc8c34
-			my $stoc = $hashes->{start_time_of_connection}->{$connID} || 0;
dc8c34
-			$hashes->{end_time_of_connection}->{$connID} = $gmtime || 0;
dc8c34
-			my $diff = $hashes->{end_time_of_connection}->{$connID} - $stoc;
dc8c34
-			$hashes->{start_time_of_connection}->{$connID} = $hashes->{end_time_of_connection}->{$connID} = 0;
dc8c34
-			if ($diff <= 1) { $latency[0]++;}
dc8c34
-			if ($diff == 2) { $latency[1]++;}
dc8c34
-			if ($diff == 3) { $latency[2]++;}
dc8c34
-			if ($diff >= 4 && $diff <=5 ) { $latency[3]++;}
dc8c34
-			if ($diff >= 6 && $diff <=10 ) { $latency[4]++;}
dc8c34
-			if ($diff >= 11 && $diff <=15 ) { $latency[5]++;}
dc8c34
-			if ($diff >= 16) { $latency[6] ++;}
dc8c34
-		}
dc8c34
+		handleConnClose($connID);
dc8c34
 	}
dc8c34
 	if (m/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
dc8c34
 		my $binddn = $1;
dc8c34
@@ -1761,13 +1800,13 @@ sub parseLineNormal
dc8c34
 			$tmpp =~ tr/A-Z/a-z/;
dc8c34
 			$hashes->{bindlist}->{$tmpp}++;
dc8c34
 			if($usage =~ /f/ || $verb eq "yes"){
dc8c34
-				$hashes->{bind_conn_op}->{"$conn,$op"} = $tmpp;
dc8c34
+				$hashes->{bind_conn_op}->{"$serverRestartCount,$conn,$op"} = $tmpp;
dc8c34
 			}
dc8c34
 		} else {
dc8c34
 			$anonymousBindCount++;
dc8c34
 			$hashes->{bindlist}->{"Anonymous Binds"}++;
dc8c34
 			if($usage =~ /f/ || $verb eq "yes"){
dc8c34
-				$hashes->{bind_conn_op}->{"$conn,$op"} = "";
dc8c34
+				$hashes->{bind_conn_op}->{"$serverRestartCount,$conn,$op"} = "";
dc8c34
 			}
dc8c34
 			inc_stats('anonbind',$s_stats,$m_stats);
dc8c34
 		}
dc8c34
@@ -1775,7 +1814,7 @@ sub parseLineNormal
dc8c34
 	if (m/ UNBIND/){
dc8c34
 		$unbindCount++;
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{unbind_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{unbind_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (m/ RESULT err=/ && m/ notes=[A-Z,]*P/){
dc8c34
@@ -1795,11 +1834,11 @@ sub parseLineNormal
dc8c34
 			#  unindexed search stat, as VLV unindexed searches aren't that bad
dc8c34
 			$unindexedSrchCountNotesA++;
dc8c34
 			if($reportStats){ inc_stats('notesA',$s_stats,$m_stats); }
dc8c34
-			if ($usage =~ /u/ || $verb eq "yes"){
dc8c34
-				$hashes->{notesa_conn_op}->{"$con,$op"}++;
dc8c34
-				if ($_ =~ /etime= *([0-9.]+)/i ){ $hashes->{etime_conn_op}->{"$con,$op"} = $1; }
dc8c34
-				if ($_ =~ / *([0-9a-z:\/]+)/i){ $hashes->{time_conn_op}->{"$con,$op"} = $1; }
dc8c34
-				if ($_ =~ /nentries= *([0-9]+)/i ){ $hashes->{nentries_conn_op}->{"$con,$op"} = $1; }
dc8c34
+			if ($usage =~ /u/ || $usage =~ /U/ || $verb eq "yes"){
dc8c34
+				$hashes->{notesa_conn_op}->{"$serverRestartCount,$con,$op"}++;
dc8c34
+				if ($_ =~ /etime= *([0-9.]+)/i ){ $hashes->{etime_conn_op}->{"$serverRestartCount,$con,$op"} = $1; }
dc8c34
+				if ($_ =~ / *([0-9a-z:\/]+)/i){ $hashes->{time_conn_op}->{"$serverRestartCount,$con,$op"} = $1; }
dc8c34
+				if ($_ =~ /nentries= *([0-9]+)/i ){ $hashes->{nentries_conn_op}->{"$serverRestartCount,$con,$op"} = $1; }
dc8c34
 			}
dc8c34
 		}
dc8c34
 		$isVlvNotes = 0;
dc8c34
@@ -1818,11 +1857,11 @@ sub parseLineNormal
dc8c34
 			#  unindexed search stat, as VLV unindexed searches aren't that bad
dc8c34
 			$unindexedSrchCountNotesU++;
dc8c34
 			if($reportStats){ inc_stats('notesU',$s_stats,$m_stats); }
dc8c34
-			if ($usage =~ /u/ || $verb eq "yes"){
dc8c34
-				$hashes->{notesu_conn_op}->{"$con,$op"}++;
dc8c34
-				if ($_ =~ /etime= *([0-9.]+)/i ){ $hashes->{etime_conn_op}->{"$con,$op"} = $1; }
dc8c34
-				if ($_ =~ / *([0-9a-z:\/]+)/i){ $hashes->{time_conn_op}->{"$con,$op"} = $1; }
dc8c34
-				if ($_ =~ /nentries= *([0-9]+)/i ){ $hashes->{nentries_conn_op}->{"$con,$op"} = $1; }
dc8c34
+			if ($usage =~ /u/ || $usage =~ /U/ || $verb eq "yes"){
dc8c34
+				$hashes->{notesu_conn_op}->{"$serverRestartCount,$con,$op"}++;
dc8c34
+				if ($_ =~ /etime= *([0-9.]+)/i ){ $hashes->{etime_conn_op}->{"$serverRestartCount,$con,$op"} = $1; }
dc8c34
+				if ($_ =~ / *([0-9a-z:\/]+)/i){ $hashes->{time_conn_op}->{"$serverRestartCount,$con,$op"} = $1; }
dc8c34
+				if ($_ =~ /nentries= *([0-9]+)/i ){ $hashes->{nentries_conn_op}->{"$serverRestartCount,$con,$op"} = $1; }
dc8c34
 			}
dc8c34
 		}
dc8c34
 		$isVlvNotes = 0;
dc8c34
@@ -1885,14 +1924,14 @@ sub parseLineNormal
dc8c34
 			$hashes->{ip_hash}->{$ip}++;
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i ){
dc8c34
 				if ($exc ne "yes"){
dc8c34
-					$hashes->{conn_hash}->{$1} = $ip;
dc8c34
+					$hashes->{conn_hash}->{"$serverRestartCount,$1"} = $ip;
dc8c34
 				}
dc8c34
 			}
dc8c34
 		}
dc8c34
 		if (m/- A1/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -1906,7 +1945,7 @@ sub parseLineNormal
dc8c34
 		if (m/- B1/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -1920,7 +1959,7 @@ sub parseLineNormal
dc8c34
 		if (m/- B4/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -1934,7 +1973,7 @@ sub parseLineNormal
dc8c34
 		if (m/- T1/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -1948,7 +1987,7 @@ sub parseLineNormal
dc8c34
 		if (m/- T2/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -1962,7 +2001,7 @@ sub parseLineNormal
dc8c34
 		if (m/- B2/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				$maxBerSizeCount++;
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
@@ -1977,7 +2016,7 @@ sub parseLineNormal
dc8c34
 		if (m/- B3/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -1991,7 +2030,7 @@ sub parseLineNormal
dc8c34
 		if (m/- R1/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -2005,7 +2044,7 @@ sub parseLineNormal
dc8c34
 		if (m/- P1/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -2019,7 +2058,7 @@ sub parseLineNormal
dc8c34
 		if (m/- P2/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -2033,7 +2072,7 @@ sub parseLineNormal
dc8c34
 		if (m/- U1/){
dc8c34
 			if ($_ =~ /conn= *([0-9A-Z]+)/i) {
dc8c34
 				$exc = "no";
dc8c34
-				$ip = getIPfromConn($1);
dc8c34
+				$ip = getIPfromConn($1, $serverRestartCount);
dc8c34
 				for (my $xxx = 0; $xxx < $#excludeIP; $xxx++){
dc8c34
 					if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
dc8c34
 				}
dc8c34
@@ -2062,10 +2101,10 @@ sub parseLineNormal
dc8c34
 		if ($_ =~ /oid=\" *([0-9\.]+)/i ){ $hashes->{oid}->{$1}++; }
dc8c34
 		if ($1 && $1 eq $startTLSoid){$startTLSCount++;}
dc8c34
 		if ($verb eq "yes"){
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{ext_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{ext_conn_op}->{"$serverRestartCount,$1,$2"}++;}
dc8c34
 		}
dc8c34
 	}
dc8c34
-	if (($usage =~ /l/ || $verb eq "yes") and / SRCH /){
dc8c34
+	if (($usage =~ /l/ || $verb eq "yes" || $usage =~ /u/ || $usage =~ /U/) and / SRCH /){
dc8c34
 		my ($filterConn, $filterOp);
dc8c34
 		if (/ SRCH / && / attrs=/ && $_ =~ /filter=\"(.*)\" /i ){
dc8c34
 			$tmpp = $1;
dc8c34
@@ -2083,13 +2122,13 @@ sub parseLineNormal
dc8c34
 			if ($_ =~ /op= *([0-9\-]+)/i) { $filterOp = $1; }
dc8c34
 		}
dc8c34
 		$filterCount++;
dc8c34
-		if($usage =~ /u/ || $verb eq "yes"){
dc8c34
+		if($usage =~ /u/ || $usage =~ /U/ || $verb eq "yes"){
dc8c34
 			# we only need this for the unindexed search report
dc8c34
-			$hashes->{filter_conn_op}->{"$filterConn,$filterOp"} = $tmpp;
dc8c34
+			$hashes->{filter_conn_op}->{"$serverRestartCount,$filterConn,$filterOp"} = $tmpp;
dc8c34
 		}
dc8c34
 	}
dc8c34
-	if ($usage =~ /a/ || $verb eq "yes"){
dc8c34
-		if (/ SRCH /   && $_ =~ /base=\"(.*)\" scope/i ){
dc8c34
+	if (($usage =~ /a/ || $verb eq "yes" || $usage =~ /u/ || $usage =~ /U/) and / SRCH /){
dc8c34
+		if ($_ =~ /base=\"(.*)\" scope/i ){
dc8c34
 			my ($conn, $op, $scopeVal);
dc8c34
 			if ($1 eq ""){
dc8c34
 				$tmpp = "Root DSE";
dc8c34
@@ -2110,10 +2149,10 @@ sub parseLineNormal
dc8c34
 			if ($_ =~ /op= *([0-9\-]+)/i) {
dc8c34
 				$op = $1;
dc8c34
 			}
dc8c34
-			if($usage =~ /u/ || $verb eq "yes"){
dc8c34
+			if($usage =~ /u/ || $usage =~ /U/ || $verb eq "yes"){
dc8c34
 				# we only need this for the unindexed search report
dc8c34
-				$hashes->{base_conn_op}->{"$conn,$op"} = $tmpp;
dc8c34
-				$hashes->{scope_conn_op}->{"$conn,$op"} = $scopeTxt[$scopeVal];
dc8c34
+				$hashes->{base_conn_op}->{"$serverRestartCount,$conn,$op"} = $tmpp;
dc8c34
+				$hashes->{scope_conn_op}->{"$serverRestartCount,$conn,$op"} = $scopeTxt[$scopeVal];
dc8c34
 			}
dc8c34
 			$baseCount++;
dc8c34
 			$scopeCount++;
dc8c34
@@ -2133,7 +2172,9 @@ sub parseLineNormal
dc8c34
 			$badPwdCount++;
dc8c34
 		} elsif (/ err=49 tag=/ ){
dc8c34
 			$badPwdCount++;
dc8c34
-			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{badpwd_conn_op}->{"$1,$2"}++;}
dc8c34
+			if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){
dc8c34
+				$hashes->{badpwd_conn_op}->{"$serverRestartCount,$1,$2"} = getIPfromConn($1, $serverRestartCount);
dc8c34
+			}
dc8c34
 		}
dc8c34
 	}
dc8c34
 	if (/ BIND / && /method=sasl/i){
dc8c34
@@ -2394,9 +2435,11 @@ sub
dc8c34
 getIPfromConn
dc8c34
 {
dc8c34
 	my $connid = shift;
dc8c34
-	if (exists($hashes->{conn_hash}->{$connid}) &&
dc8c34
-		defined($hashes->{conn_hash}->{$connid})) {
dc8c34
-		return $hashes->{conn_hash}->{$connid};
dc8c34
+	my $serverRestartCount = shift;
dc8c34
+	my $key = "$serverRestartCount,$connid";
dc8c34
+	if (exists($hashes->{conn_hash}->{$key}) &&
dc8c34
+		defined($hashes->{conn_hash}->{$key})) {
dc8c34
+		return $hashes->{conn_hash}->{$key};
dc8c34
 	}
dc8c34
 
dc8c34
 	return "Unknown_Host";
dc8c34
diff --git a/man/man1/logconv.pl.1 b/man/man1/logconv.pl.1
dc8c34
index c2a8cd8..46e7c96 100644
dc8c34
--- a/man/man1/logconv.pl.1
dc8c34
+++ b/man/man1/logconv.pl.1
dc8c34
@@ -21,7 +21,7 @@ logconv.pl \- analyzes Directory Server access log files
dc8c34
 .B logconv.pl 
dc8c34
 [\fI\-h\fR] [\fI\-d <rootDN>\fR] [\fI\-s <size limit>\fR] [\fI\-v\fR] [\fI\-V\fR]
dc8c34
 [\fI\-S <start time>\fR] [\fI\-E <end time>\fR]
dc8c34
-[\fI\-efcibaltnxgju\fR] [\fI access log ... ... \fR]
dc8c34
+[\fI\-efcibaltnxgjuU\fR] [\fI access log ... ... \fR]
dc8c34
 .PP
dc8c34
 .SH DESCRIPTION
dc8c34
 Analyzes Directory Server access log files for specific information defined on the command
dc8c34
@@ -68,10 +68,10 @@ This option creates a CSV report for spreadsheets.
dc8c34
 .B \fB\-B, \-\-bind\fR <ALL | ANONYMOUS | "Bind DN">
dc8c34
 This generates a report based on either ALL bind dn's, anonymous binds, or a specific DN.
dc8c34
 .TP
dc8c34
-\fB\-V, \-\-verbose\fR <enable verbose output \- includes all stats listed below>
dc8c34
+\fB\-V, \-\-verbose\fR <enable verbose output \- includes all stats listed below except U>
dc8c34
 Verbose output
dc8c34
 .TP
dc8c34
-.B \fB\-[efcibaltnxgju]\fR
dc8c34
+.B \fB\-[efcibaltnxgjuU]\fR
dc8c34
 .br
dc8c34
 \fBe\fR Error Code stats
dc8c34
 .br
dc8c34
@@ -99,11 +99,13 @@ Verbose output
dc8c34
 .br
dc8c34
 \fBj\fR Recommendations
dc8c34
 .br
dc8c34
-\fBu\fR Unindexed Search Stats
dc8c34
+\fBu\fR Unindexed Search Stats (very detailed)
dc8c34
 .br
dc8c34
 \fBy\fR Connection Latency Stats
dc8c34
 .br
dc8c34
 \fBp\fR Open Connection ID Stats
dc8c34
+.br
dc8c34
+\fBU\fR Unindexed Search Summary
dc8c34
 .PP
dc8c34
 .SH USAGE
dc8c34
 Examples:
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34