Blame SOURCES/0027-Ticket-47533-logconv-some-stats-do-not-work-across-s.patch

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