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