andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 6 months ago
Clone
dc8c34
From 379c6d281c9ee8d2acef321565cd10505b15a016 Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Fri, 19 Apr 2013 14:55:41 -0600
dc8c34
Subject: [PATCH 127/225] Ticket #47336 - logconv.pl -m not working for all
dc8c34
 stats
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47336
dc8c34
Reviewed by: nhosoi (Thanks!)
dc8c34
Branch: 389-ds-base-1.3.1
dc8c34
Fix Description: Code was using $reportStat instead of $reportStats.  Also,
dc8c34
some fields such as connections, ssl connections were not being kept.
dc8c34
Finally, some headers were missing.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: no
dc8c34
(cherry picked from commit 27f2595bfd54c85bb169ac45cac2cdbfd4de17fc)
dc8c34
(cherry picked from commit 26bd66a10ab942c8782294d89a9e3e1768bc7936)
dc8c34
(cherry picked from commit 54193cb97b9157d0da785719a3d91f0f58cfb5e7)
dc8c34
(cherry picked from commit c1b093d754020ef1b92825df1ec4e9bf7f424a01)
dc8c34
---
dc8c34
 ldap/admin/src/logconv.pl | 33 ++++++++++++++++++---------------
dc8c34
 1 file changed, 18 insertions(+), 15 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
dc8c34
index 7e0bfd8..757f799 100755
dc8c34
--- a/ldap/admin/src/logconv.pl
dc8c34
+++ b/ldap/admin/src/logconv.pl
dc8c34
@@ -1564,7 +1564,7 @@ sub parseLineNormal
dc8c34
 
dc8c34
 	# Additional performance stats
dc8c34
 	($time, $tzone) = split (' ', $_);
dc8c34
-	if ($reportStat && $time ne $last_tm)
dc8c34
+	if ($reportStats && $time ne $last_tm)
dc8c34
 	{
dc8c34
 		$last_tm = $time;
dc8c34
 		$time =~ s/\[//;
dc8c34
@@ -1597,11 +1597,11 @@ sub parseLineNormal
dc8c34
 
dc8c34
 	if (m/ RESULT err/){ 
dc8c34
 		$allResults++; 
dc8c34
-		if($reportStat){ inc_stats('results',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('results',$s_stats,$m_stats); }
dc8c34
 	}
dc8c34
 	if (m/ SRCH/){
dc8c34
 		$srchCount++;
dc8c34
-		if($reportStat){ inc_stats('srch',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('srch',$s_stats,$m_stats); }
dc8c34
 		if ($_ =~ / attrs=\"(.*)\"/i){
dc8c34
 			$anyAttrs++;
dc8c34
 			$attrs = $1 . " ";
dc8c34
@@ -1620,7 +1620,7 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ DEL/){
dc8c34
 		$delCount++;
dc8c34
-		if($reportStat){ inc_stats('del',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('del',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
 			if ($_ =~ /conn= *([0-9]+)/i){ writeFile($DEL_CONN, $1);}
dc8c34
 			if ($_ =~ /op= *([0-9]+)/i){ writeFile($DEL_OP, $1);}
dc8c34
@@ -1628,7 +1628,7 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ MOD dn=/){
dc8c34
 		$modCount++;
dc8c34
-		if($reportStat){ inc_stats('mod',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('mod',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
 		        if ($_ =~ /conn= *([0-9]+)/i){ writeFile($MOD_CONN, $1);}
dc8c34
 			if ($_ =~ /op= *([0-9]+)/i){ writeFile($MOD_OP, $1); }
dc8c34
@@ -1636,7 +1636,7 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ ADD/){
dc8c34
 		$addCount++;
dc8c34
-		if($reportStat){ inc_stats('add',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('add',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
 		        if ($_ =~ /conn= *([0-9]+)/i){ writeFile($ADD_CONN, $1); }
dc8c34
 			if ($_ =~ /op= *([0-9]+)/i){ writeFile($ADD_OP, $1); }
dc8c34
@@ -1644,7 +1644,7 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ MODRDN/){
dc8c34
 		$modrdnCount++;
dc8c34
-		if($reportStat){ inc_stats('modrdn',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('modrdn',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"){
dc8c34
 		        if ($_ =~ /conn= *([0-9]+)/i){ writeFile($MODRDN_CONN, $1); }
dc8c34
 			if ($_ =~ /op= *([0-9]+)/i){ writeFile($MODRDN_OP, $1); }
dc8c34
@@ -1652,7 +1652,7 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ CMP dn=/){
dc8c34
 		$cmpCount++;
dc8c34
-		if($reportStat){ inc_stats('cmp',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('cmp',$s_stats,$m_stats); }
dc8c34
 		if ($verb eq "yes"  || $usage =~ /g/i){
dc8c34
 			if ($_ =~ /conn= *([0-9]+)/i){ writeFile($CMP_CONN, $1);}
dc8c34
 			if ($_ =~ /op= *([0-9]+)/i){ writeFile($CMP_OP, $1);}
dc8c34
@@ -1660,7 +1660,7 @@ sub parseLineNormal
dc8c34
 	}
dc8c34
 	if (m/ ABANDON /){
dc8c34
 		$abandonCount++;
dc8c34
-		if($reportStat){ inc_stats('abandon',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('abandon',$s_stats,$m_stats); }
dc8c34
 		$allResults++;
dc8c34
 		if ($_ =~ /targetop= *([0-9a-zA-Z]+)/i ){
dc8c34
 			writeFile($TARGET_OP, $1);
dc8c34
@@ -1680,12 +1680,12 @@ sub parseLineNormal
dc8c34
 	if (m/ version=2/){$v2BindCount++}
dc8c34
 	if (m/ version=3/){$v3BindCount++}
dc8c34
 	if (m/ conn=1 fd=/){$serverRestartCount++}
dc8c34
-	if (m/ SSL connection from/){$sslCount++;}
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
 		$autobindCount++;
dc8c34
 		$bindCount++;
dc8c34
-		if($reportStat){ inc_stats('bind',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('bind',$s_stats,$m_stats); }
dc8c34
 		if ($1 ne ""){ 
dc8c34
 			$tmpp = $1;
dc8c34
 			$tmpp =~ tr/A-Z/a-z/;
dc8c34
@@ -1705,7 +1705,10 @@ sub parseLineNormal
dc8c34
 			for ($xxx =0; $xxx <= $#excludeIP; $xxx++){
dc8c34
 				if ($excludeIP[$xxx] eq $1){$exc = "yes";}
dc8c34
 			}
dc8c34
-			if ($exc ne "yes"){ $connectionCount++;}
dc8c34
+			if ($exc ne "yes"){
dc8c34
+				$connectionCount++;
dc8c34
+				if($reportStats){ inc_stats('conns',$s_stats,$m_stats); }
dc8c34
+			}
dc8c34
 		}
dc8c34
 		$simConnection++;
dc8c34
 		if ($simConnection > $maxsimConnection) {
dc8c34
@@ -1740,7 +1743,7 @@ sub parseLineNormal
dc8c34
 		if ($diff >= 16) { $latency[6] ++;}
dc8c34
 	}
dc8c34
 	if (m/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
dc8c34
-		if($reportStat){ inc_stats('bind',$s_stats,$m_stats); }
dc8c34
+		if($reportStats){ inc_stats('bind',$s_stats,$m_stats); }
dc8c34
 		$bindCount++;
dc8c34
 		if ($1 ne ""){ 
dc8c34
 			if($1 eq $rootDN){$rootDNBindCount++;}
dc8c34
@@ -1782,7 +1785,7 @@ sub parseLineNormal
dc8c34
 			#  We don't want to record vlv unindexed searches for our regular "bad" 
dc8c34
 			#  unindexed search stat, as VLV unindexed searches aren't that bad
dc8c34
 			$unindexedSrchCount++;
dc8c34
-			if($reportStat){ inc_stats('notesu',$s_stats,$m_stats); }
dc8c34
+			if($reportStats){ inc_stats('notesu',$s_stats,$m_stats); }
dc8c34
 		}
dc8c34
 		if ($usage =~ /u/ || $verb eq "yes"){
dc8c34
 			if ($isVlvNnotes == 0 ){
dc8c34
@@ -2242,7 +2245,7 @@ print_stats_block
dc8c34
 			    		"\n" );
dc8c34
 			} else {
dc8c34
 				$stats->{'fh'}->print(
dc8c34
-			    		"Time,time_t,Results,Search,Add,Mod,Modrdn,Delete,Abandon,".
dc8c34
+			    		"Time,time_t,Results,Search,Add,Mod,Modrdn,Moddn,Compare,Delete,Abandon,".
dc8c34
 			    		"Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed\n"
dc8c34
 			    	);
dc8c34
 			}
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34