amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone

Blame SOURCES/0037-Ticket-47949-logconv.pl-support-parsing-showing-repo.patch

f92ce9
From b4a38681279529caab2c221ed19ead5636c41071 Mon Sep 17 00:00:00 2001
f92ce9
From: Mark Reynolds <mreynolds@redhat.com>
f92ce9
Date: Fri, 5 Dec 2014 15:42:45 -0500
f92ce9
Subject: [PATCH 37/53] Ticket 47949 - logconv.pl -- support
f92ce9
 parsing/showing/reporting different protocol versions
f92ce9
f92ce9
Description:  Update script to report on the secure protocol versions that are now available
f92ce9
              in the access log.
f92ce9
f92ce9
              Also, revised the connection section output, cleaned up the SASL bind report,
f92ce9
              and handled issue with log(s) that only span 1 second(0 elapsed time)
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47949
f92ce9
f92ce9
Reviewed by: nhosoi & rmeggins(Thanks!!)
f92ce9
f92ce9
(cherry picked from commit 7aeeb7c968a03f4a75c8338ffbd7cbbaa73e102d)
f92ce9
(cherry picked from commit 8b7ae6d930927171c7976fe9093f2f765714c8ac)
f92ce9
---
f92ce9
 ldap/admin/src/logconv.pl | 69 ++++++++++++++++++++++++++++++++++++-----------
f92ce9
 1 file changed, 53 insertions(+), 16 deletions(-)
f92ce9
f92ce9
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
f92ce9
index 0611755..e4bbfbc 100755
f92ce9
--- a/ldap/admin/src/logconv.pl
f92ce9
+++ b/ldap/admin/src/logconv.pl
f92ce9
@@ -69,7 +69,7 @@ if ($#ARGV < 0){;
f92ce9
 
f92ce9
 my $file_count = 0;
f92ce9
 my $arg_count = 0;
f92ce9
-my $logversion = "8.0";
f92ce9
+my $logversion = "8.1";
f92ce9
 my $sizeCount = "20";
f92ce9
 my $startFlag = 0;
f92ce9
 my $startTime = 0;
f92ce9
@@ -262,7 +262,14 @@ my $startTLSCount = 0;
f92ce9
 my $ldapiCount = 0;
f92ce9
 my $autobindCount = 0;
f92ce9
 my $limit = 25000; # number of lines processed to trigger output
f92ce9
-
f92ce9
+my $searchStat;
f92ce9
+my $modStat;
f92ce9
+my $addStat;
f92ce9
+my $deleteStat;
f92ce9
+my $modrdnStat;
f92ce9
+my $compareStat;
f92ce9
+my $bindCountStat;
f92ce9
+my %cipher = ();
f92ce9
 my @removefiles = ();
f92ce9
 
f92ce9
 my @conncodes = qw(A1 B1 B4 T1 T2 B2 B3 R1 P1 P2 U1);
f92ce9
@@ -680,27 +687,45 @@ if($reportStats ne ""){
f92ce9
 
f92ce9
 print "Restarts:                     $serverRestartCount\n";
f92ce9
 print "Total Connections:            $connectionCount\n";
f92ce9
-print " - StartTLS Connections:      $startTLSCount\n";
f92ce9
-print " - LDAPS Connections:         $sslCount\n";
f92ce9
+print " - LDAP Connections:          " . ($connectionCount - $sslCount - $ldapiCount) . "\n";
f92ce9
 print " - LDAPI Connections:         $ldapiCount\n";
f92ce9
+print " - LDAPS Connections:         $sslCount\n";
f92ce9
+print " - StartTLS Extended Ops:     $startTLSCount\n";
f92ce9
+if(%cipher){
f92ce9
+	print " Secure Protocol Versions:\n";
f92ce9
+	foreach my $key (sort { $b cmp $a } keys %cipher) {
f92ce9
+		print "  - $key - $cipher{$key}\n";
f92ce9
+	}
f92ce9
+	print "\n";
f92ce9
+}
f92ce9
+
f92ce9
 print "Peak Concurrent Connections:  $maxsimConnection\n";
f92ce9
 print "Total Operations:             $allOps\n";
f92ce9
 print "Total Results:                $allResults\n";
f92ce9
 my ($perf, $tmp);
f92ce9
 if ($allOps ne "0"){
f92ce9
- print sprintf "Overall Performance:          %.1f%%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
f92ce9
- }
f92ce9
-else {
f92ce9
- print "Overall Performance:          No Operations to evaluate\n\n";
f92ce9
+	print sprintf "Overall Performance:          %.1f%%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
f92ce9
+} else {
f92ce9
+	print "Overall Performance:          No Operations to evaluate\n\n";
f92ce9
 }
f92ce9
 
f92ce9
-my $searchStat = sprintf "(%.2f/sec)  (%.2f/min)\n",($srchCount / $totalTimeInSecs), $srchCount / ($totalTimeInSecs/60);
f92ce9
-my $modStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$modCount / $totalTimeInSecs, $modCount/($totalTimeInSecs/60);
f92ce9
-my $addStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$addCount/$totalTimeInSecs, $addCount/($totalTimeInSecs/60);
f92ce9
-my $deleteStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$delCount/$totalTimeInSecs, $delCount/($totalTimeInSecs/60);
f92ce9
-my $modrdnStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$modrdnCount/$totalTimeInSecs, $modrdnCount/($totalTimeInSecs/60);
f92ce9
-my $compareStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$cmpCount/$totalTimeInSecs, $cmpCount/($totalTimeInSecs/60);
f92ce9
-my $bindCountStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$bindCount/$totalTimeInSecs, $bindCount/($totalTimeInSecs/60);
f92ce9
+if ($totalTimeInSecs == 0){
f92ce9
+	$searchStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+	$modStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+	$addStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+	$deleteStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+	$modrdnStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+	$compareStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+	$bindCountStat = sprintf "(%.2f/sec)  (%.2f/min)\n","0", "0";
f92ce9
+} else {
f92ce9
+	$searchStat = sprintf "(%.2f/sec)  (%.2f/min)\n",($srchCount / $totalTimeInSecs), $srchCount / ($totalTimeInSecs/60);
f92ce9
+	$modStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$modCount / $totalTimeInSecs, $modCount/($totalTimeInSecs/60);
f92ce9
+	$addStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$addCount/$totalTimeInSecs, $addCount/($totalTimeInSecs/60);
f92ce9
+	$deleteStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$delCount/$totalTimeInSecs, $delCount/($totalTimeInSecs/60);
f92ce9
+	$modrdnStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$modrdnCount/$totalTimeInSecs, $modrdnCount/($totalTimeInSecs/60);
f92ce9
+	$compareStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$cmpCount/$totalTimeInSecs, $cmpCount/($totalTimeInSecs/60);
f92ce9
+	$bindCountStat = sprintf "(%.2f/sec)  (%.2f/min)\n",$bindCount/$totalTimeInSecs, $bindCount/($totalTimeInSecs/60);
f92ce9
+}
f92ce9
 
f92ce9
 format STDOUT =
f92ce9
 Searches:                     @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
f92ce9
@@ -973,7 +998,7 @@ print " - SASL Binds:                $saslBindCount\n";
f92ce9
 if ($saslBindCount > 0){
f92ce9
 	my $saslmech = $hashes->{saslmech};
f92ce9
 	foreach my $saslb ( sort {$saslmech->{$b} <=> $saslmech->{$a} } (keys %{$saslmech}) ){
f92ce9
-		printf "    %-4s  %-12s\n",$saslmech->{$saslb}, $saslb;
f92ce9
+		printf "    %-4s - %s\n",$saslb, $saslmech->{$saslb};
f92ce9
 	}
f92ce9
 }
f92ce9
 
f92ce9
@@ -1908,6 +1933,18 @@ sub parseLineNormal
f92ce9
 		handleRestart();
f92ce9
 	}
f92ce9
 	if (m/ SSL connection from/){$sslCount++; if($reportStats){ inc_stats('sslconns',$s_stats,$m_stats); }}
f92ce9
+	# Gather TLS and SSL version info
f92ce9
+	if ($_ =~ /conn= *([0-9A-Z]+) TLS *(.*)/){
f92ce9
+		$cipher{"TLS" . $2}++;
f92ce9
+	}
f92ce9
+	if ($_ =~ /conn= *([0-9A-Z]+) SSL *(.*)/){
f92ce9
+		my $sslversion = $2;
f92ce9
+		if(/SSL /){
f92ce9
+			$cipher{"SSL " . $sslversion}++;
f92ce9
+		} else {
f92ce9
+			$cipher{"SSL" . $sslversion}++;
f92ce9
+		}
f92ce9
+	}
f92ce9
 	if (m/ connection from local to /){$ldapiCount++;}
f92ce9
 	if($_ =~ /AUTOBIND dn=\"(.*)\"/){
f92ce9
 		$autobindCount++;
f92ce9
-- 
f92ce9
1.9.3
f92ce9