|
|
dc8c34 |
From 3e2112a0af1e3572fd848f761d47f84250cf234d Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
dc8c34 |
Date: Tue, 15 Jan 2013 15:36:33 -0500
|
|
|
dc8c34 |
Subject: [PATCH 125/225] Ticket 419 - logconv.pl - improve memory management
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug Description: logconv.pl memory usage is very high, and doesn't
|
|
|
dc8c34 |
appear to be efficient.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix Description: For verbose stats/hashes/arrays we now write this
|
|
|
dc8c34 |
information to disk, and read it in and process it
|
|
|
dc8c34 |
when printing the report. This dramatically improved
|
|
|
dc8c34 |
memory growth when dealing with larger and larger log sets.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Also updated the oids which some were incorrect, but
|
|
|
dc8c34 |
many new oids were missing. Added stats for "Paged Searches",
|
|
|
dc8c34 |
and "Max BER size exceeded".
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Finally, renamed most variables to be readable names,
|
|
|
dc8c34 |
removed redundant counters, and other generic imrpovements.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/419
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by: Noriko(Thanks!)
|
|
|
dc8c34 |
(cherry picked from commit 16651d642bf6f7ba624f62cac867b495253b4f3f)
|
|
|
dc8c34 |
(cherry picked from commit 9866682da7fb35e16922d94404c4265701fc797a)
|
|
|
dc8c34 |
(cherry picked from commit aba08ee08425ac9dd9e914635714c8ae0ea6e54f)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/admin/src/logconv.pl | 2639 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
dc8c34 |
1 file changed, 2639 insertions(+)
|
|
|
dc8c34 |
create mode 100755 ldap/admin/src/logconv.pl
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
|
|
|
dc8c34 |
new file mode 100755
|
|
|
dc8c34 |
index 0000000..7ea7f09
|
|
|
dc8c34 |
--- /dev/null
|
|
|
dc8c34 |
+++ b/ldap/admin/src/logconv.pl
|
|
|
dc8c34 |
@@ -0,0 +1,2639 @@
|
|
|
dc8c34 |
+#!/usr/bin/env perl
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# BEGIN COPYRIGHT BLOCK
|
|
|
dc8c34 |
+# This Program is free software; you can redistribute it and/or modify it under
|
|
|
dc8c34 |
+# the terms of the GNU General Public License as published by the Free Software
|
|
|
dc8c34 |
+# Foundation; version 2 of the License.
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# This Program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
dc8c34 |
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
dc8c34 |
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# You should have received a copy of the GNU General Public License along with
|
|
|
dc8c34 |
+# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
dc8c34 |
+# Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# In addition, as a special exception, Red Hat, Inc. gives You the additional
|
|
|
dc8c34 |
+# right to link the code of this Program with code not covered under the GNU
|
|
|
dc8c34 |
+# General Public License ("Non-GPL Code") and to distribute linked combinations
|
|
|
dc8c34 |
+# including the two, subject to the limitations in this paragraph. Non-GPL Code
|
|
|
dc8c34 |
+# permitted under this exception must only link to the code of this Program
|
|
|
dc8c34 |
+# through those well defined interfaces identified in the file named EXCEPTION
|
|
|
dc8c34 |
+# found in the source code files (the "Approved Interfaces"). The files of
|
|
|
dc8c34 |
+# Non-GPL Code may instantiate templates or use macros or inline functions from
|
|
|
dc8c34 |
+# the Approved Interfaces without causing the resulting work to be covered by
|
|
|
dc8c34 |
+# the GNU General Public License. Only Red Hat, Inc. may make changes or
|
|
|
dc8c34 |
+# additions to the list of Approved Interfaces. You must obey the GNU General
|
|
|
dc8c34 |
+# Public License in all respects for all of the Program code and other code used
|
|
|
dc8c34 |
+# in conjunction with the Program except the Non-GPL Code covered by this
|
|
|
dc8c34 |
+# exception. If you modify this file, you may extend this exception to your
|
|
|
dc8c34 |
+# version of the file, but you are not obligated to do so. If you do not wish to
|
|
|
dc8c34 |
+# provide this exception without modification, you must delete this exception
|
|
|
dc8c34 |
+# statement from your version and license this file solely under the GPL without
|
|
|
dc8c34 |
+# exception.
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
|
|
|
dc8c34 |
+# Copyright (C) 2013 Red Hat, Inc.
|
|
|
dc8c34 |
+# All rights reserved.
|
|
|
dc8c34 |
+# END COPYRIGHT BLOCK
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Check for usage
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+use Time::Local;
|
|
|
dc8c34 |
+use IO::File;
|
|
|
dc8c34 |
+use Getopt::Long;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+Getopt::Long::Configure ("bundling");
|
|
|
dc8c34 |
+Getopt::Long::Configure ("permute");
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($#ARGV < 0){;
|
|
|
dc8c34 |
+&displayUsage;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# parse commandline switches #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$file_count = 0;
|
|
|
dc8c34 |
+$arg_count = 0;
|
|
|
dc8c34 |
+$logversion = "7.0";
|
|
|
dc8c34 |
+$sizeCount = "20";
|
|
|
dc8c34 |
+$startFlag = 0;
|
|
|
dc8c34 |
+$startTime = 0;
|
|
|
dc8c34 |
+$endFlag = 0;
|
|
|
dc8c34 |
+$endTime = 0;
|
|
|
dc8c34 |
+$reportStats = "";
|
|
|
dc8c34 |
+$dataLocation = "/tmp";
|
|
|
dc8c34 |
+$s_stats = new_stats_block( );
|
|
|
dc8c34 |
+$m_stats = new_stats_block( );
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+GetOptions(
|
|
|
dc8c34 |
+ 'd|rootDN=s' => \$rootDN,
|
|
|
dc8c34 |
+ 'v|version' => sub { print "Access Log Analyzer v$logversion\n"; exit (0); },
|
|
|
dc8c34 |
+ 'V|verbose' => sub { $verb = "yes"; },
|
|
|
dc8c34 |
+ 'D|data=s' => \$dataLocation,
|
|
|
dc8c34 |
+ 'X|excludeIP=s' => \$excludeIP[$xi++],
|
|
|
dc8c34 |
+ 's|sizeLimit=s' => \$sizeCount,
|
|
|
dc8c34 |
+ 'S|startTime=s' => \$startTime,
|
|
|
dc8c34 |
+ 'E|endTime=s' => \$endTime,
|
|
|
dc8c34 |
+ 'B|bind=s' => sub { $reportBinds = "yes"; $bindReportDN=($_[1]) },
|
|
|
dc8c34 |
+ 'm|reportFileSecs=s' => sub { my ($opt,$value) = @_; $s_stats = new_stats_block($value); $reportStats = "-m";},
|
|
|
dc8c34 |
+ 'M|reportFileMins=s' => sub { my ($opt,$value) = @_; $m_stats = new_stats_block($value); $reportStats = "-M";},
|
|
|
dc8c34 |
+ 'h|help' => sub { displayUsage() },
|
|
|
dc8c34 |
+ # usage options '-efcibaltnxgjuiryp'
|
|
|
dc8c34 |
+ 'e' => sub { $usage = $usage . "e"; },
|
|
|
dc8c34 |
+ 'f' => sub { $usage = $usage . "f"; },
|
|
|
dc8c34 |
+ 'c' => sub { $usage = $usage . "c"; },
|
|
|
dc8c34 |
+ 'i' => sub { $usage = $usage . "i"; },
|
|
|
dc8c34 |
+ 'b' => sub { $usage = $usage . "b"; },
|
|
|
dc8c34 |
+ 'a' => sub { $usage = $usage . "a"; },
|
|
|
dc8c34 |
+ 'l' => sub { $usage = $usage . "l"; },
|
|
|
dc8c34 |
+ 't' => sub { $usage = $usage . "t"; },
|
|
|
dc8c34 |
+ 'n' => sub { $usage = $usage . "n"; },
|
|
|
dc8c34 |
+ 'x' => sub { $usage = $usage . "x"; },
|
|
|
dc8c34 |
+ 'g' => sub { $usage = $usage . "g"; },
|
|
|
dc8c34 |
+ 'j' => sub { $usage = $usage . "j"; },
|
|
|
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 |
+);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# setup the report Bind DN if any
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+if($reportBinds eq "yes"){
|
|
|
dc8c34 |
+ $bindReportDN =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
+ if($bindReportDN eq "all"){
|
|
|
dc8c34 |
+ $bindReportDN = "";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if($bindReportDN eq "anonymous"){
|
|
|
dc8c34 |
+ $bindReportDN = "Anonymous";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# set the default root DN
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+if($rootDN eq ""){
|
|
|
dc8c34 |
+ $rootDN = "cn=directory manager";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# get the logs
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+while($arg_count <= $#ARGV){
|
|
|
dc8c34 |
+ $files[$file_count] = $ARGV[$arg_count];
|
|
|
dc8c34 |
+ $file_count++;
|
|
|
dc8c34 |
+ $arg_count++;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if($file_count == 0){
|
|
|
dc8c34 |
+ if($reportStats){
|
|
|
dc8c34 |
+ print "Usage error for option $reportStats, either the output file or access log is missing!\n\n";
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ print "There are no access logs specified!\n\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ exit 1;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($sizeCount eq "all"){$sizeCount = "100000";}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Initialize Arrays and variables #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "\nAccess Log Analyzer $logversion\n";
|
|
|
dc8c34 |
+print "\nCommand: logconv.pl @ARGV\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$rootDNBindCount = 0;
|
|
|
dc8c34 |
+$anonymousBindCount = 0;
|
|
|
dc8c34 |
+$unindexedSrchCount = 0;
|
|
|
dc8c34 |
+$vlvNotesCount= 0;
|
|
|
dc8c34 |
+$srchCount = 0;
|
|
|
dc8c34 |
+$fdTaken = 0;
|
|
|
dc8c34 |
+$fdReturned = 0;
|
|
|
dc8c34 |
+$highestFdTaken = 0;
|
|
|
dc8c34 |
+$unbindCount = 0;
|
|
|
dc8c34 |
+$cmpCount = 0;
|
|
|
dc8c34 |
+$modCount = 0;
|
|
|
dc8c34 |
+$delCount = 0;
|
|
|
dc8c34 |
+$addCount = 0;
|
|
|
dc8c34 |
+$modrdnCount = 0;
|
|
|
dc8c34 |
+$abandonCount = 0;
|
|
|
dc8c34 |
+$extopCount = 0;
|
|
|
dc8c34 |
+$vlvCount = 0;
|
|
|
dc8c34 |
+$errorCount = 0;
|
|
|
dc8c34 |
+$proxiedAuthCount = 0;
|
|
|
dc8c34 |
+$serverRestartCount = 0;
|
|
|
dc8c34 |
+$resourceUnavailCount = 0;
|
|
|
dc8c34 |
+$brokenPipeCount = 0;
|
|
|
dc8c34 |
+$v2BindCount = 0;
|
|
|
dc8c34 |
+$v3BindCount = 0;
|
|
|
dc8c34 |
+$vlvSortCount = 0;
|
|
|
dc8c34 |
+$connResetByPeerCount = 0;
|
|
|
dc8c34 |
+$isVlvNotes = 0;
|
|
|
dc8c34 |
+$successCount = 0;
|
|
|
dc8c34 |
+$sslCount = 0;
|
|
|
dc8c34 |
+$sslClientBindCount = 0;
|
|
|
dc8c34 |
+$sslClientFailedCount = 0;
|
|
|
dc8c34 |
+$objectclassTopCount= 0;
|
|
|
dc8c34 |
+$pagedSearchCount = 0;
|
|
|
dc8c34 |
+$bindCount = 0;
|
|
|
dc8c34 |
+$filterCount = 0;
|
|
|
dc8c34 |
+$baseCount = 0;
|
|
|
dc8c34 |
+$scopeCount = 0;
|
|
|
dc8c34 |
+$allOps = 0;
|
|
|
dc8c34 |
+$allResults = 0;
|
|
|
dc8c34 |
+$badPwdCount = 0;
|
|
|
dc8c34 |
+$saslBindCount = 0;
|
|
|
dc8c34 |
+$internalOpCount = 0;
|
|
|
dc8c34 |
+$entryOpCount = 0;
|
|
|
dc8c34 |
+$referralCount = 0;
|
|
|
dc8c34 |
+$anyAttrs = 0;
|
|
|
dc8c34 |
+$persistentSrchCount = 0;
|
|
|
dc8c34 |
+$maxBerSizeCount = 0;
|
|
|
dc8c34 |
+$connectionCount = 0;
|
|
|
dc8c34 |
+$timerange = 0;
|
|
|
dc8c34 |
+$simConnection = 0;
|
|
|
dc8c34 |
+$maxsimConnection = 0;
|
|
|
dc8c34 |
+$firstFile = 1;
|
|
|
dc8c34 |
+$elapsedDays = 0;
|
|
|
dc8c34 |
+$logCount = 0;
|
|
|
dc8c34 |
+$limit = 25000; # number of lines processed to trigger output
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# hash files
|
|
|
dc8c34 |
+$ATTR = "$dataLocation/attr.logconv";
|
|
|
dc8c34 |
+$RC = "$dataLocation/rc.logconv";
|
|
|
dc8c34 |
+$SRC = "$dataLocation/src.logconv";
|
|
|
dc8c34 |
+$RSRC = "$dataLocation/rsrc.logconv";
|
|
|
dc8c34 |
+$EXCOUNT = "$dataLocation/excount.logconv";
|
|
|
dc8c34 |
+$CONN_HASH = "$dataLocation/conn_hash.logconv";
|
|
|
dc8c34 |
+$IP_HASH = "$dataLocation/ip_hash.logconv";
|
|
|
dc8c34 |
+$CONNCOUNT = "$dataLocation/conncount.logconv";
|
|
|
dc8c34 |
+$NENTRIES = "$dataLocation/nentries.logconv";
|
|
|
dc8c34 |
+$FILTER = "$dataLocation/filter.logconv";
|
|
|
dc8c34 |
+$BASE = "$dataLocation/base.logconv";
|
|
|
dc8c34 |
+$DS6XBADPWD = "$dataLocation/ds6xbadpwd.logconv";
|
|
|
dc8c34 |
+$SASLMECH = "$dataLocation/saslmech.logconv";
|
|
|
dc8c34 |
+$BINDLIST = "$dataLocation/bindlist.logconv";
|
|
|
dc8c34 |
+$ETIME = "$dataLocation/etime.logconv";
|
|
|
dc8c34 |
+$OID = "$dataLocation/oid.logconv";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# array files
|
|
|
dc8c34 |
+$SRCH_CONN = "$dataLocation/srchconn.logconv";
|
|
|
dc8c34 |
+$SRCH_OP = "$dataLocation/srchop.logconv";
|
|
|
dc8c34 |
+$DEL_CONN = "$dataLocation/delconn.logconv";
|
|
|
dc8c34 |
+$DEL_OP = "$dataLocation/delop.logconv";
|
|
|
dc8c34 |
+$MOD_CONN = "$dataLocation/modconn.logconv";
|
|
|
dc8c34 |
+$MOD_OP = "$dataLocation/modop.logconv";
|
|
|
dc8c34 |
+$ADD_CONN = "$dataLocation/addconn.logconv";
|
|
|
dc8c34 |
+$ADD_OP = "$dataLocation/addop.logconv";
|
|
|
dc8c34 |
+$MODRDN_CONN = "$dataLocation/modrdnconn.logconv";
|
|
|
dc8c34 |
+$MODRDN_OP = "$dataLocation/modrdnop.logconv";
|
|
|
dc8c34 |
+$CMP_CONN = "$dataLocation/cmpconn.logconv";
|
|
|
dc8c34 |
+$CMP_OP = "$dataLocation/cmpop.logconv";
|
|
|
dc8c34 |
+$TARGET_CONN = "$dataLocation/targetconn.logconv";
|
|
|
dc8c34 |
+$TARGET_OP = "$dataLocation/targetop.logconv";
|
|
|
dc8c34 |
+$MSGID = "$dataLocation/msgid.logconv";
|
|
|
dc8c34 |
+$BIND_CONN = "$dataLocation/bindconn.logconv";
|
|
|
dc8c34 |
+$BIND_OP = "$dataLocation/bindop.logconv";
|
|
|
dc8c34 |
+$UNBIND_CONN = "$dataLocation/unbindconn.logconv";
|
|
|
dc8c34 |
+$UNBIND_OP = "$dataLocation/unbindop.logconv";
|
|
|
dc8c34 |
+$EXT_CONN = "$dataLocation/extconn.logconv";
|
|
|
dc8c34 |
+$EXT_OP = "$dataLocation/extop.logconv";
|
|
|
dc8c34 |
+$NOTES_ETIME = "$dataLocation/notesetime.logconv";
|
|
|
dc8c34 |
+$NOTES_CONN = "$dataLocation/notesconn.logconv";
|
|
|
dc8c34 |
+$NOTES_OP = "$dataLocation/notesop.logconv";
|
|
|
dc8c34 |
+$NOTES_TIME = "$dataLocation/notestime.logconv";
|
|
|
dc8c34 |
+$NOTES_NENTRIES = "$dataLocation/notesnentries.logconv";
|
|
|
dc8c34 |
+$BADPWDCONN = "$dataLocation/badpwdconn.logconv";
|
|
|
dc8c34 |
+$BADPWDOP = "$dataLocation/badpwdop.logconv";
|
|
|
dc8c34 |
+$BADPWDIP = "$dataLocation/badpwdip.logconv";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# info files
|
|
|
dc8c34 |
+$BINDINFO = "$dataLocation/bindinfo.logconv";
|
|
|
dc8c34 |
+$BASEINFO = "$dataLocation/baseinfo.logconv";
|
|
|
dc8c34 |
+$FILTERINFO = "$dataLocation/filterinfo.logconv";
|
|
|
dc8c34 |
+$SCOPEINFO = "$dataLocation/scopeinfo.logconv";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$err[0] = "Successful Operations\n";
|
|
|
dc8c34 |
+$err[1] = "Operations Error(s)\n";
|
|
|
dc8c34 |
+$err[2] = "Protocal Errors\n";
|
|
|
dc8c34 |
+$err[3] = "Time Limit Exceeded\n";
|
|
|
dc8c34 |
+$err[4] = "Size Limit Exceeded\n";
|
|
|
dc8c34 |
+$err[5] = "Compare False\n";
|
|
|
dc8c34 |
+$err[6] = "Compare True\n";
|
|
|
dc8c34 |
+$err[7] = "Strong Authentication Not Supported\n";
|
|
|
dc8c34 |
+$err[8] = "Strong Authentication Required\n";
|
|
|
dc8c34 |
+$err[9] = "Partial Results\n";
|
|
|
dc8c34 |
+$err[10] = "Referral Received\n";
|
|
|
dc8c34 |
+$err[11] = "Administrative Limit Exceeded (Look Through Limit)\n";
|
|
|
dc8c34 |
+$err[12] = "Unavailable Critical Extension\n";
|
|
|
dc8c34 |
+$err[13] = "Confidentiality Required\n";
|
|
|
dc8c34 |
+$err[14] = "SASL Bind in Progress\n";
|
|
|
dc8c34 |
+$err[16] = "No Such Attribute\n";
|
|
|
dc8c34 |
+$err[17] = "Undefined Type\n";
|
|
|
dc8c34 |
+$err[18] = "Inappropriate Matching\n";
|
|
|
dc8c34 |
+$err[19] = "Constraint Violation\n";
|
|
|
dc8c34 |
+$err[20] = "Type or Value Exists\n";
|
|
|
dc8c34 |
+$err[21] = "Invalid Syntax\n";
|
|
|
dc8c34 |
+$err[32] = "No Such Object\n";
|
|
|
dc8c34 |
+$err[33] = "Alias Problem\n";
|
|
|
dc8c34 |
+$err[34] = "Invalid DN Syntax\n";
|
|
|
dc8c34 |
+$err[35] = "Is Leaf\n";
|
|
|
dc8c34 |
+$err[36] = "Alias Deref Problem\n";
|
|
|
dc8c34 |
+$err[48] = "Inappropriate Authentication (No password presented, etc)\n";
|
|
|
dc8c34 |
+$err[49] = "Invalid Credentials (Bad Password)\n";
|
|
|
dc8c34 |
+$err[50] = "Insufficent (write) Privledges\n";
|
|
|
dc8c34 |
+$err[51] = "Busy\n";
|
|
|
dc8c34 |
+$err[52] = "Unavailable\n";
|
|
|
dc8c34 |
+$err[53] = "Unwilling To Perform\n";
|
|
|
dc8c34 |
+$err[54] = "Loop Detected\n";
|
|
|
dc8c34 |
+$err[60] = "Sort Control Missing\n";
|
|
|
dc8c34 |
+$err[61] = "Index Range Error\n";
|
|
|
dc8c34 |
+$err[64] = "Naming Violation\n";
|
|
|
dc8c34 |
+$err[65] = "Objectclass Violation\n";
|
|
|
dc8c34 |
+$err[66] = "Not Allowed on Non Leaf\n";
|
|
|
dc8c34 |
+$err[67] = "Not Allowed on RDN\n";
|
|
|
dc8c34 |
+$err[68] = "Already Exists\n";
|
|
|
dc8c34 |
+$err[69] = "No Objectclass Mods\n";
|
|
|
dc8c34 |
+$err[70] = "Results Too Large\n";
|
|
|
dc8c34 |
+$err[71] = "Effect Multiple DSA's\n";
|
|
|
dc8c34 |
+$err[80] = "Other :-)\n";
|
|
|
dc8c34 |
+$err[81] = "Server Down\n";
|
|
|
dc8c34 |
+$err[82] = "Local Error\n";
|
|
|
dc8c34 |
+$err[83] = "Encoding Error\n";
|
|
|
dc8c34 |
+$err[84] = "Decoding Error\n";
|
|
|
dc8c34 |
+$err[85] = "Timeout\n";
|
|
|
dc8c34 |
+$err[86] = "Authentication Unknown\n";
|
|
|
dc8c34 |
+$err[87] = "Filter Error\n";
|
|
|
dc8c34 |
+$err[88] = "User Canceled\n";
|
|
|
dc8c34 |
+$err[89] = "Parameter Error\n";
|
|
|
dc8c34 |
+$err[90] = "No Memory\n";
|
|
|
dc8c34 |
+$err[91] = "Connect Error\n";
|
|
|
dc8c34 |
+$err[92] = "Not Supported\n";
|
|
|
dc8c34 |
+$err[93] = "Control Not Found\n";
|
|
|
dc8c34 |
+$err[94] = "No Results Returned\n";
|
|
|
dc8c34 |
+$err[95] = "More Results To Return\n";
|
|
|
dc8c34 |
+$err[96] = "Client Loop\n";
|
|
|
dc8c34 |
+$err[97] = "Referral Limit Exceeded\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$conn{"A1"} = "A1";
|
|
|
dc8c34 |
+$conn{"B1"} = "B1";
|
|
|
dc8c34 |
+$conn{"B4"} = "B4";
|
|
|
dc8c34 |
+$conn{"T1"} = "T1";
|
|
|
dc8c34 |
+$conn{"T2"} = "T2";
|
|
|
dc8c34 |
+$conn{"B2"} = "B2";
|
|
|
dc8c34 |
+$conn{"B3"} = "B3";
|
|
|
dc8c34 |
+$conn{"R1"} = "R1";
|
|
|
dc8c34 |
+$conn{"P1"} = "P1";
|
|
|
dc8c34 |
+$conn{"P2"} = "P2";
|
|
|
dc8c34 |
+$conn{"U1"} = "U1";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$connmsg{"A1"} = "Client Aborted Connections";
|
|
|
dc8c34 |
+$connmsg{"B1"} = "Bad Ber Tag Encountered";
|
|
|
dc8c34 |
+$connmsg{"B4"} = "Server failed to flush data (response) back to Client";
|
|
|
dc8c34 |
+$connmsg{"T1"} = "Idle Timeout Exceeded";
|
|
|
dc8c34 |
+$connmsg{"T2"} = "IO Block Timeout Exceeded or NTSSL Timeout";
|
|
|
dc8c34 |
+$connmsg{"B2"} = "Ber Too Big";
|
|
|
dc8c34 |
+$connmsg{"B3"} = "Ber Peek";
|
|
|
dc8c34 |
+$connmsg{"R1"} = "Revents";
|
|
|
dc8c34 |
+$connmsg{"P1"} = "Plugin";
|
|
|
dc8c34 |
+$connmsg{"P2"} = "Poll";
|
|
|
dc8c34 |
+$connmsg{"U1"} = "Cleanly Closed Connections";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+%monthname = (
|
|
|
dc8c34 |
+ "Jan" => 0,
|
|
|
dc8c34 |
+ "Feb" => 1,
|
|
|
dc8c34 |
+ "Mar" => 2,
|
|
|
dc8c34 |
+ "Apr" => 3,
|
|
|
dc8c34 |
+ "May" => 4,
|
|
|
dc8c34 |
+ "Jun" => 5,
|
|
|
dc8c34 |
+ "Jul" => 6,
|
|
|
dc8c34 |
+ "Aug" => 7,
|
|
|
dc8c34 |
+ "Sep" => 8,
|
|
|
dc8c34 |
+ "Oct" => 9,
|
|
|
dc8c34 |
+ "Nov" => 10,
|
|
|
dc8c34 |
+ "Dec" => 11,
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+openDataFiles();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+##########################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Parse Access Logs #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+##########################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($files[$#files] =~ m/access.rotationinfo/) { $file_count--; }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "Processing $file_count Access Log(s)...\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#print "Filename\t\t\t Total Lines\n";
|
|
|
dc8c34 |
+#print "--------------------------------------------------\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($file_count > 1 && $files[0] =~ /\/access$/){
|
|
|
dc8c34 |
+ $files[$file_count] = $files[0];
|
|
|
dc8c34 |
+ $file_count++;
|
|
|
dc8c34 |
+ $skipFirstFile = 1;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+$logCount = $file_count;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+for ($count=0; $count < $file_count; $count++){
|
|
|
dc8c34 |
+ # we moved access to the end of the list, so if its the first file skip it
|
|
|
dc8c34 |
+ if($file_count > 1 && $count == 0 && $skipFirstFile == 1){
|
|
|
dc8c34 |
+ next;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $logsize = `wc -l $files[$count]`;
|
|
|
dc8c34 |
+ $logsize =~ /([0-9]+)/;
|
|
|
dc8c34 |
+ $linesProcessed = 0; $lineBlockCount = 0;
|
|
|
dc8c34 |
+ $logCount--;
|
|
|
dc8c34 |
+ if($logCount < 10 ){
|
|
|
dc8c34 |
+ # add a zero for formatting purposes
|
|
|
dc8c34 |
+ $logCountStr = "0" . $logCount;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $logCountStr = $logCount;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print sprintf "[%s] %-30s\tlines: %7s\n",$logCountStr, $files[$count], $1;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ open(LOG,"$files[$count]") or do { openFailed($!, $files[$count]) };
|
|
|
dc8c34 |
+ $firstline = "yes";
|
|
|
dc8c34 |
+ while(<LOG>){
|
|
|
dc8c34 |
+ unless ($endFlag) {
|
|
|
dc8c34 |
+ if ($firstline eq "yes"){
|
|
|
dc8c34 |
+ if (/^\[/) {
|
|
|
dc8c34 |
+ $logline = $_;
|
|
|
dc8c34 |
+ $firstline = "no";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $linesProcessed++;$lineBlockCount++;
|
|
|
dc8c34 |
+ } elsif (/^\[/ && $firstline eq "no"){
|
|
|
dc8c34 |
+ &parseLine();
|
|
|
dc8c34 |
+ $logline = $_;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $logline = $logline . $_;
|
|
|
dc8c34 |
+ $logline =~ s/\n//;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ &parseLine();
|
|
|
dc8c34 |
+ close (LOG);
|
|
|
dc8c34 |
+ print_stats_block( $s_stats );
|
|
|
dc8c34 |
+ print_stats_block( $m_stats );
|
|
|
dc8c34 |
+ $totalLineCount = $totalLineCount + $linesProcessed;
|
|
|
dc8c34 |
+ if($linesProcessed => $limit){print sprintf " %10s Lines Processed\n\n",--$linesProcessed;}
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "\n\nTotal Log Lines Analysed: " . ($totalLineCount - 1) . "\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$allOps = $srchCount + $modCount + $addCount + $cmpCount + $delCount + $modrdnCount + $bindCount + $extopCount + $abandonCount + $vlvCount;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+##################################################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Calculate the total elapsed time of the processed access logs #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+##################################################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# if we are using startTime & endTime then we need to clean it up for our processing
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if($startTime){
|
|
|
dc8c34 |
+ if ($start =~ / *([0-9a-z:\/]+)/i){$start=$1;}
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+if($endTime){
|
|
|
dc8c34 |
+ if ($end =~ / *([0-9a-z:\/]+)/i){$end =$1;}
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Get the start time in seconds
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$logStart = $start;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($logStart =~ / *([0-9A-Z\/]+)/i ){
|
|
|
dc8c34 |
+ $logDate = $1;
|
|
|
dc8c34 |
+ @dateComps = split /\//, $logDate;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $timeMonth = 1 +$monthname{$dateComps[1]};
|
|
|
dc8c34 |
+ $timeMonth = $timeMonth * 3600 *24 * 30;
|
|
|
dc8c34 |
+ $timeDay= $dateComps[0] * 3600 *24;
|
|
|
dc8c34 |
+ $timeYear = $dateComps[2] *365 * 3600 * 24;
|
|
|
dc8c34 |
+ $dateTotal = $timeMonth + $timeDay + $timeYear;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($logStart =~ / *(:[0-9:]+)/i ){
|
|
|
dc8c34 |
+ $logTime = $1;
|
|
|
dc8c34 |
+ @timeComps = split /:/, $logTime;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $timeHour = $timeComps[1] * 3600;
|
|
|
dc8c34 |
+ $timeMinute = $timeComps[2] *60;
|
|
|
dc8c34 |
+ $timeSecond = $timeComps[3];
|
|
|
dc8c34 |
+ $timeTotal = $timeHour + $timeMinute + $timeSecond;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$startTotal = $timeTotal + $dateTotal;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Get the end time in seconds
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$logEnd = $end;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($logEnd =~ / *([0-9A-Z\/]+)/i ){
|
|
|
dc8c34 |
+ $logDate = $1;
|
|
|
dc8c34 |
+ @dateComps = split /\//, $logDate;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $endDay = $dateComps[0] *3600 * 24;
|
|
|
dc8c34 |
+ $endMonth = 1 + $monthname{$dateComps[1]};
|
|
|
dc8c34 |
+ $endMonth = $endMonth * 3600 * 24 * 30;
|
|
|
dc8c34 |
+ $endYear = $endTotal + $dateComps[2] *365 * 3600 * 24 ;
|
|
|
dc8c34 |
+ $dateTotal = $endDay + $endMonth + $endYear;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($logEnd =~ / *(:[0-9:]+)/i ){
|
|
|
dc8c34 |
+ $logTime = $1;
|
|
|
dc8c34 |
+ @timeComps = split /:/, $logTime;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $endHour = $timeComps[1] * 3600;
|
|
|
dc8c34 |
+ $endMinute = $timeComps[2] *60;
|
|
|
dc8c34 |
+ $endSecond = $timeComps[3];
|
|
|
dc8c34 |
+ $timeTotal = $endHour + $endMinute + $endSecond;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$endTotal = $timeTotal + $dateTotal;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Tally the numbers
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+$totalTimeInSecs = $endTotal - $startTotal;
|
|
|
dc8c34 |
+$remainingTimeInSecs = $totalTimeInSecs;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Calculate the elapsed time
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# days
|
|
|
dc8c34 |
+while(($remainingTimeInSecs - 86400) > 0){
|
|
|
dc8c34 |
+ $elapsedDays++;
|
|
|
dc8c34 |
+ $remainingTimeInSecs = $remainingTimeInSecs - 86400;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# hours
|
|
|
dc8c34 |
+while(($remainingTimeInSecs - 3600) > 0){
|
|
|
dc8c34 |
+ $elapsedHours++;
|
|
|
dc8c34 |
+ $remainingTimeInSecs = $remainingTimeInSecs - 3600;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# minutes
|
|
|
dc8c34 |
+while($remainingTimeInSecs - 60 > 0){
|
|
|
dc8c34 |
+ $elapsedMinutes++;
|
|
|
dc8c34 |
+ $remainingTimeInSecs = $remainingTimeInSecs - 60;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# seconds
|
|
|
dc8c34 |
+$elapsedSeconds = $remainingTimeInSecs;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# Initialize empty values
|
|
|
dc8c34 |
+if($elapsedHours eq ""){
|
|
|
dc8c34 |
+ $elapsedHours = "0";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+if($elapsedMinutes eq ""){
|
|
|
dc8c34 |
+ $elapsedMinutes = "0";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+if($elapsedSeconds eq ""){
|
|
|
dc8c34 |
+ $elapsedSeconds = "0";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+&closeDataFiles();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#####################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Display Basic Results #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#####################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "\n\n----------- Access Log Output ------------\n";
|
|
|
dc8c34 |
+print "\nStart of Logs: $start\n";
|
|
|
dc8c34 |
+print "End of Logs: $end\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if($elapsedDays eq "0"){
|
|
|
dc8c34 |
+ print "Processed Log Time: $elapsedHours Hours, $elapsedMinutes Minutes, $elapsedSeconds Seconds\n\n";
|
|
|
dc8c34 |
+} else {
|
|
|
dc8c34 |
+ print "Processed Log Time: $elapsedDays Days, $elapsedHours Hours, $elapsedMinutes Minutes, $elapsedSeconds Seconds\n\n";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Check here if we are producing any unqiue reports
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if($reportBinds eq "yes"){
|
|
|
dc8c34 |
+ &displayBindReport();
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# Continue with standard report
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "Restarts: $serverRestartCount\n";
|
|
|
dc8c34 |
+print "Total Connections: $connectionCount\n";
|
|
|
dc8c34 |
+print "SSL Connections: $sslCount\n";
|
|
|
dc8c34 |
+print "Peak Concurrent Connections: $maxsimConnection\n";
|
|
|
dc8c34 |
+print "Total Operations: $allOps\n";
|
|
|
dc8c34 |
+print "Total Results: $allResults\n";
|
|
|
dc8c34 |
+if ($allOps ne "0"){
|
|
|
dc8c34 |
+ print sprintf "Overall Performance: %.1f%\n\n" , ($perf = ($tmp = ($allResults / $allOps)*100) > 100 ? 100.0 : $tmp) ;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+else {
|
|
|
dc8c34 |
+ print "Overall Performance: No Operations to evaluate\n\n";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+$searchStat = sprintf "(%.2f/sec) (%.2f/min)\n",($srchCount / $totalTimeInSecs), $srchCount / ($totalTimeInSecs/60);
|
|
|
dc8c34 |
+$modStat = sprintf "(%.2f/sec) (%.2f/min)\n",$modCount / $totalTimeInSecs, $modCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+$addStat = sprintf "(%.2f/sec) (%.2f/min)\n",$addCount/$totalTimeInSecs, $addCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+$deleteStat = sprintf "(%.2f/sec) (%.2f/min)\n",$delCount/$totalTimeInSecs, $delCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+$modrdnStat = sprintf "(%.2f/sec) (%.2f/min)\n",$modrdnCount/$totalTimeInSecs, $modrdnCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+$compareStat = sprintf "(%.2f/sec) (%.2f/min)\n",$cmpCount/$totalTimeInSecs, $cmpCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+$bindCountStat = sprintf "(%.2f/sec) (%.2f/min)\n",$bindCount/$totalTimeInSecs, $bindCount/($totalTimeInSecs/60);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+format STDOUT =
|
|
|
dc8c34 |
+Searches: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $srchCount, $searchStat
|
|
|
dc8c34 |
+Modifications: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $modCount, $modStat
|
|
|
dc8c34 |
+Adds: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $addCount, $addStat
|
|
|
dc8c34 |
+Deletes: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $delCount, $deleteStat
|
|
|
dc8c34 |
+Mod RDNs: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $modrdnCount, $modrdnStat
|
|
|
dc8c34 |
+Compares: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $cmpCount, $compareStat
|
|
|
dc8c34 |
+Binds: @<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<
|
|
|
dc8c34 |
+ $bindCount $bindCountStat
|
|
|
dc8c34 |
+.
|
|
|
dc8c34 |
+write STDOUT;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "\n";
|
|
|
dc8c34 |
+print "Proxied Auth Operations: $proxiedAuthCount\n";
|
|
|
dc8c34 |
+print "Persistent Searches: $persistentSrchCount\n";
|
|
|
dc8c34 |
+print "Internal Operations: $internalOpCount\n";
|
|
|
dc8c34 |
+print "Entry Operations: $entryOpCount\n";
|
|
|
dc8c34 |
+print "Extended Operations: $extopCount\n";
|
|
|
dc8c34 |
+print "Abandoned Requests: $abandonCount\n";
|
|
|
dc8c34 |
+print "Smart Referrals Received: $referralCount\n";
|
|
|
dc8c34 |
+print "\n";
|
|
|
dc8c34 |
+print "VLV Operations: $vlvCount\n";
|
|
|
dc8c34 |
+print "VLV Unindexed Searches: $vlvNotesCount\n";
|
|
|
dc8c34 |
+print "SORT Operations: $vlvSortCount\n";
|
|
|
dc8c34 |
+print "\n";
|
|
|
dc8c34 |
+print "Entire Search Base Queries: $objectclassTopCount\n";
|
|
|
dc8c34 |
+print "Paged Searches: $pagedSearchCount\n";
|
|
|
dc8c34 |
+print "Unindexed Searches: $unindexedSrchCount\n";
|
|
|
dc8c34 |
+if ($verb eq "yes" || $usage =~ /u/){
|
|
|
dc8c34 |
+ if ($unindexedSrchCount > 0){
|
|
|
dc8c34 |
+ %conn_hash = getHashFromFile($CONN_HASH);
|
|
|
dc8c34 |
+ @notesConn = getArrayFromFile($NOTES_CONN);
|
|
|
dc8c34 |
+ @notesOp = getArrayFromFile($NOTES_OP);
|
|
|
dc8c34 |
+ @notesEtime = getArrayFromFile($NOTES_ETIME);
|
|
|
dc8c34 |
+ @notesTime = getArrayFromFile($NOTES_TIME);
|
|
|
dc8c34 |
+ @notesNentries = getArrayFromFile($NOTES_NENTRIES);
|
|
|
dc8c34 |
+ getInfoArraysFromFile($BASEINFO);
|
|
|
dc8c34 |
+ @base_val = @fileArray1;
|
|
|
dc8c34 |
+ @base_conn = @fileArray2;
|
|
|
dc8c34 |
+ @base_op = @fileArray3;
|
|
|
dc8c34 |
+ getInfoArraysFromFile($SCOPEINFO);
|
|
|
dc8c34 |
+ @scope_val = @fileArray1;
|
|
|
dc8c34 |
+ @scope_conn = @fileArray2;
|
|
|
dc8c34 |
+ @scope_op = @fileArray3;
|
|
|
dc8c34 |
+ getInfoArraysFromFile($FILTERINFO);
|
|
|
dc8c34 |
+ @filter_val = @fileArray1;
|
|
|
dc8c34 |
+ @filter_conn = @fileArray2;
|
|
|
dc8c34 |
+ @filter_op = @fileArray3;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $notesCount = "1";
|
|
|
dc8c34 |
+ for ($n = 0; $n <= $#notesEtime; $n++){
|
|
|
dc8c34 |
+ @alreadyseenDN = ();
|
|
|
dc8c34 |
+ if($conn_hash{$notesConn[$n]} eq ""){
|
|
|
dc8c34 |
+ $unindexedIp = "?";
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $unindexedIp = $conn_hash{$notesConn[$n]};
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "\n Unindexed Search #".$notesCount."\n"; $notesCount++;
|
|
|
dc8c34 |
+ print " - Date/Time: $notesTime[$n]\n";
|
|
|
dc8c34 |
+ print " - Connection Number: $notesConn[$n]\n";
|
|
|
dc8c34 |
+ print " - Operation Number: $notesOp[$n]\n";
|
|
|
dc8c34 |
+ print " - Etime: $notesEtime[$n]\n";
|
|
|
dc8c34 |
+ print " - Nentries: $notesNentries[$n]\n";
|
|
|
dc8c34 |
+ print " - IP Address: $unindexedIp\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ for ($nnn = 0; $nnn < $baseCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn[$n] eq $base_conn[$nnn] && $notesOp[$n] eq $base_op[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Base: $base_val[$nnn]\n";
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($nnn = 0; $nnn < $scopeCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn[$n] eq $scope_conn[$nnn] && $notesOp[$n] eq $scope_op[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Scope: $scope_val[$nnn]\n";
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($nnn = 0; $nnn < $filterCount; $nnn++){
|
|
|
dc8c34 |
+ if ($notesConn[$n] eq $filter_conn[$nnn] && $notesOp[$n] eq $filter_op[$nnn]){
|
|
|
dc8c34 |
+ print " - Search Filter: $filter_val[$nnn]\n";
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %conn_hash;
|
|
|
dc8c34 |
+ undef @notesConn;
|
|
|
dc8c34 |
+ undef @notesOp;
|
|
|
dc8c34 |
+ undef @notesEtime;
|
|
|
dc8c34 |
+ undef @notesTime;
|
|
|
dc8c34 |
+ undef @notesNentries;
|
|
|
dc8c34 |
+ undef @notesIp;
|
|
|
dc8c34 |
+ undef @filter_val;
|
|
|
dc8c34 |
+ undef @filter_conn;
|
|
|
dc8c34 |
+ undef @filter_op;
|
|
|
dc8c34 |
+ undef @base_val;
|
|
|
dc8c34 |
+ undef @base_conn;
|
|
|
dc8c34 |
+ undef @base_op;
|
|
|
dc8c34 |
+ undef @scope_val;
|
|
|
dc8c34 |
+ undef @scope_conn;
|
|
|
dc8c34 |
+ undef @scope_op;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+} # end of unindexed search report
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "\n";
|
|
|
dc8c34 |
+print "FDs Taken: $fdTaken\n";
|
|
|
dc8c34 |
+print "FDs Returned: $fdReturned\n";
|
|
|
dc8c34 |
+print "Highest FD Taken: $highestFdTaken\n\n";
|
|
|
dc8c34 |
+print "Broken Pipes: $brokenPipeCount\n";
|
|
|
dc8c34 |
+if ($brokenPipeCount > 0){
|
|
|
dc8c34 |
+ foreach $key (sort { $rc{$b} <=> $rc{$a} } keys %rc) {
|
|
|
dc8c34 |
+ if ($rc{$key} > 0){
|
|
|
dc8c34 |
+ if ($conn{$key} eq ""){$conn{$key} = "**Unknown**";}
|
|
|
dc8c34 |
+ push @etext, sprintf " - %-4s (%2s) %-40s\n",$rc{$key},$conn{$key},$connmsg{$key
|
|
|
dc8c34 |
+};
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print @etext;
|
|
|
dc8c34 |
+ print "\n";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "Connections Reset By Peer: $connResetByPeerCount\n";
|
|
|
dc8c34 |
+if ($connResetByPeerCount > 0){
|
|
|
dc8c34 |
+ foreach $key (sort { $src{$b} <=> $src{$a} } keys %src) {
|
|
|
dc8c34 |
+ if ($src{$key} > 0){
|
|
|
dc8c34 |
+ if ($conn{$key} eq ""){$conn{$key} = "**Unknown**";}
|
|
|
dc8c34 |
+ push @retext, sprintf " - %-4s (%2s) %-40s\n",$src{$key},$conn{$key},$connmsg{$key
|
|
|
dc8c34 |
+};
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print @retext;
|
|
|
dc8c34 |
+ print "\n";
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "Resource Unavailable: $resourceUnavailCount\n";
|
|
|
dc8c34 |
+if ($resourceUnavailCount > 0){
|
|
|
dc8c34 |
+ foreach $key (sort { $rsrc{$b} <=> $rsrc{$a} } keys %rsrc) {
|
|
|
dc8c34 |
+ if ($rsrc{$key} > 0){
|
|
|
dc8c34 |
+ if ($conn{$key} eq ""){$conn{$key} = "**Resource Issue**";}
|
|
|
dc8c34 |
+ push @rtext, sprintf " - %-4s (%2s) %-40s\n",$rsrc{$key},$conn{$key},$connmsg{$key};
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print @rtext;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+print "Max BER Size Exceeded: $maxBerSizeCount\n";
|
|
|
dc8c34 |
+print "\n";
|
|
|
dc8c34 |
+print "Binds: $bindCount\n";
|
|
|
dc8c34 |
+print "Unbinds: $unbindCount\n";
|
|
|
dc8c34 |
+print "\n LDAP v2 Binds: $v2BindCount\n";
|
|
|
dc8c34 |
+print " LDAP v3 Binds: $v3BindCount\n";
|
|
|
dc8c34 |
+print " SSL Client Binds: $sslClientBindCount\n";
|
|
|
dc8c34 |
+print " Failed SSL Client Binds: $sslClientFailedCount\n";
|
|
|
dc8c34 |
+print " SASL Binds: $saslBindCount\n";
|
|
|
dc8c34 |
+if ($saslBindCount > 0){
|
|
|
dc8c34 |
+ foreach $saslb ( sort {$saslmech{$b} <=> $saslmech{$a} } (keys %saslmech) ){
|
|
|
dc8c34 |
+ printf " %-4s %-12s\n",$saslmech{$saslb}, $saslb;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+print "\n Directory Manager Binds: $rootDNBindCount\n";
|
|
|
dc8c34 |
+print " Anonymous Binds: $anonymousBindCount\n";
|
|
|
dc8c34 |
+$otherBindCount = $bindCount -($rootDNBindCount + $anonymousBindCount);
|
|
|
dc8c34 |
+print " Other Binds: $otherBindCount\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+##########################################################################
|
|
|
dc8c34 |
+# Verbose Logging Section #
|
|
|
dc8c34 |
+##########################################################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Display Connection Latency #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($verb eq "yes" || $usage =~ /y/){
|
|
|
dc8c34 |
+ print "\n\n----- Connection Latency Details -----\n\n";
|
|
|
dc8c34 |
+ print " (in seconds)\t\t<=1\t2\t3\t4-5\t6-10\t11-15\t>15\n";
|
|
|
dc8c34 |
+ print " --------------------------------------------------------------------------\n";
|
|
|
dc8c34 |
+ print " (# of connections)\t";
|
|
|
dc8c34 |
+ for ($i=0; $i <=$#latency; $i++) {
|
|
|
dc8c34 |
+ print "$latency[$i]\t";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Display Open Connections #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($verb eq "yes" || $usage =~ /p/){
|
|
|
dc8c34 |
+ if ($openConnection[0] ne ""){
|
|
|
dc8c34 |
+ print "\n\n----- Current Open Connection IDs ----- \n\n";
|
|
|
dc8c34 |
+ for ($i=0; $i <= $#openConnection ; $i++) {
|
|
|
dc8c34 |
+ if ($openConnection[$i]) {
|
|
|
dc8c34 |
+ print "Conn Number: $i (" . getIPfromConn($i) . ")\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Display Error Codes #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /e/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ print "\n\n----- Errors -----\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ %er = sort( {$b <=> $a} %er);
|
|
|
dc8c34 |
+ for ($i = 0; $i<98; $i++){
|
|
|
dc8c34 |
+ if ($err[$i] ne "" && $errorCode[$i] >0) {
|
|
|
dc8c34 |
+ push @errtext, sprintf "%-8s %12s %-25s","err=$i",$errorCode[$i],$err[$i];
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ for ($i = 0; $i < $#errtext; $i++){
|
|
|
dc8c34 |
+ for ($ii = 0; $ii < $#errtext; $ii++){
|
|
|
dc8c34 |
+ $yy="0";
|
|
|
dc8c34 |
+ $zz="0";
|
|
|
dc8c34 |
+ while ($errtext[$ii] =~ /(\w+)\s/g){
|
|
|
dc8c34 |
+ $errornum[$yy]="$1";
|
|
|
dc8c34 |
+ $yy++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ while ($errtext[$ii+1] =~ /(\w+)\s/g){
|
|
|
dc8c34 |
+ $errornum2[$zz]="$1";
|
|
|
dc8c34 |
+ $zz++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($errornum2[1] > $errornum[1]){
|
|
|
dc8c34 |
+ $tmp = $errtext[$ii];
|
|
|
dc8c34 |
+ $errtext[$ii] = $errtext[$ii+1];
|
|
|
dc8c34 |
+ $errtext[$ii+1] = $tmp;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($i = 0; $i <= $#errtext; $i++){
|
|
|
dc8c34 |
+ $errtext[$i] =~ s/\n//g;
|
|
|
dc8c34 |
+ print "\n" . $errtext[$i];
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+####################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Print Failed Logins #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+####################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($verb eq "yes" || $usage =~ /f/ ){
|
|
|
dc8c34 |
+ if ($badPwdCount > 0){
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Failed Logins ------\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if ($ds6x eq "true"){
|
|
|
dc8c34 |
+ %ds6xbadpwd = getCounterHashFromFile($DS6XBADPWD);
|
|
|
dc8c34 |
+ $ds6loop = 0;
|
|
|
dc8c34 |
+ foreach $ds6bp (sort { $ds6xbadpwd{$b} <=> $ds6xbadpwd{$a} } keys %ds6xbadpwd) {
|
|
|
dc8c34 |
+ if ($eloop > $sizeCount){ last; }
|
|
|
dc8c34 |
+ printf "%-4s %-40s\n", $ds6xbadpwd{$ds6bp}, $ds6bp;
|
|
|
dc8c34 |
+ $ds6loop++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %ds6xbadpwd;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ getInfoArraysFromFile($BINDINFO);
|
|
|
dc8c34 |
+ @bindVal = @fileArray1;
|
|
|
dc8c34 |
+ @bindConn = @fileArray2;
|
|
|
dc8c34 |
+ @bindOp = @fileArray3;
|
|
|
dc8c34 |
+ @badPasswordConn = getArrayFromFile($BADPWDCONN);
|
|
|
dc8c34 |
+ @badPasswordOp = getArrayFromFile($BADPWDOP);
|
|
|
dc8c34 |
+ @badPasswordIp = getArrayFromFile($BADPWDIP);
|
|
|
dc8c34 |
+ for ($ii =0 ; $ii < $badPwdCount; $ii++){
|
|
|
dc8c34 |
+ for ($i = 0; $i < $bindCount; $i++){
|
|
|
dc8c34 |
+ if ($badPasswordConn[$ii] eq $bindConn[$i] && $badPasswordOp[$ii] eq $bindOp[$i] ){
|
|
|
dc8c34 |
+ $badPassword{ "$bindVal[$i]" } = $badPassword{ "$bindVal[$i]" } + 1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ # sort the new hash of $badPassword{}
|
|
|
dc8c34 |
+ $bpTotal = 0;
|
|
|
dc8c34 |
+ $bpCount = 0;
|
|
|
dc8c34 |
+ foreach $badpw (sort {$badPassword{$b} <=> $badPassword{$a} } keys %badPassword){
|
|
|
dc8c34 |
+ if ($bpCount > $sizeCount){ last;}
|
|
|
dc8c34 |
+ $bpCount++;
|
|
|
dc8c34 |
+ $bpTotal = $bpTotal + $badPassword{"$badpw"};
|
|
|
dc8c34 |
+ printf "%-4s %-40s\n", $badPassword{"$badpw"}, $badpw;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "\nFrom the IP address(s) :\n\n";
|
|
|
dc8c34 |
+ for ($i=0; $i<$badPwdCount; $i++) {
|
|
|
dc8c34 |
+ print "\t\t$badPasswordIp[$i]\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($bpTotal > $badPwdCount){
|
|
|
dc8c34 |
+ print "\n** Warning : Wrongly reported failed login attempts : ". ($bpTotal - $badPwdCount) . "\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef @bindVal;
|
|
|
dc8c34 |
+ undef @bindConn;
|
|
|
dc8c34 |
+ undef @bindOp;
|
|
|
dc8c34 |
+ undef @badPasswordConn;
|
|
|
dc8c34 |
+ undef @badPasswordOp;
|
|
|
dc8c34 |
+ undef @badPasswordIp;
|
|
|
dc8c34 |
+ } # this ends the if $ds6x = true
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+####################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Print Connection Codes #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+####################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($connCodeCount > 0){
|
|
|
dc8c34 |
+ if ($usage =~ /c/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ print "\n\n----- Total Connection Codes -----\n\n";
|
|
|
dc8c34 |
+ %conncount = &getCounterHashFromFile($CONNCOUNT);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ foreach $key (sort { $conncount{$b} <=> $conncount{$a} } keys %conncount) {
|
|
|
dc8c34 |
+ if ($conncount{$key} > 0){
|
|
|
dc8c34 |
+ push @conntext, sprintf "%-4s %6s %-40s\n",$key,$conncount{$key},$connmsg{ $key };
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print @conntext;
|
|
|
dc8c34 |
+ undef %conncount;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+########################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather and Process all unique IPs #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+########################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /i/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ %ip_hash = getTwoDimHashFromFile($IP_HASH);
|
|
|
dc8c34 |
+ %exCount = getCounterHashFromFile($EXCOUNT);
|
|
|
dc8c34 |
+ @ipkeys = keys %ip_hash;
|
|
|
dc8c34 |
+ @exxCount = keys %exCount;
|
|
|
dc8c34 |
+ $ip_count = ($#ipkeys + 1)-($#exxCount + 1);
|
|
|
dc8c34 |
+ if ($ip_count > 0){
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Clients -----\n\n";
|
|
|
dc8c34 |
+ print "Number of Clients: $ip_count\n\n";
|
|
|
dc8c34 |
+ foreach $key (sort { $ip_hash{$b}{"count"} <=> $ip_hash{$a}{"count"} } keys %ip_hash) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ if ($ccount > $sizeCount){ last;}
|
|
|
dc8c34 |
+ $ccount++;
|
|
|
dc8c34 |
+ for ($xxx =0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($excludeIP[$xxx] eq $key){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ if ($ip_hash{ $key }{"count"} eq ""){$ip_hash{ $key }{"count"} = "?";}
|
|
|
dc8c34 |
+ printf "[%s] Client: %s\n",$ccount, $key;
|
|
|
dc8c34 |
+ printf "%10s - Connections\n", $ip_hash{ $key }{"count"};
|
|
|
dc8c34 |
+ foreach $code (sort { $ip_hash{ $key }{$b} <=> $ip_hash{ $key }{$a} } keys %{$ip_hash{ $key }}) {
|
|
|
dc8c34 |
+ if ($code eq 'count' ) { next; }
|
|
|
dc8c34 |
+ printf "%10s - %s (%s)\n", $ip_hash{ $key }{ $code }, $code, $connmsg{ $code };
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %exCount;
|
|
|
dc8c34 |
+ undef %ip_hash;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather All unique Bind DN's #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+###################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /b/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ %bindlist = getCounterHashFromFile($BINDLIST);
|
|
|
dc8c34 |
+ @bindkeys = keys %bindlist;
|
|
|
dc8c34 |
+ $bind_count = $#bindkeys + 1;
|
|
|
dc8c34 |
+ if ($bind_count > 0){
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Bind DN's -----\n\n";
|
|
|
dc8c34 |
+ print "Number of Unique Bind DN's: $bind_count\n\n";
|
|
|
dc8c34 |
+ $bindcount = 0;
|
|
|
dc8c34 |
+ foreach $dn (sort { $bindlist{$b} <=> $bindlist{$a} } keys %bindlist) {
|
|
|
dc8c34 |
+ if ($bindcount < $sizeCount){
|
|
|
dc8c34 |
+ printf "%-8s %-40s\n", $bindlist{ $dn },$dn;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $bindcount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %bindlist;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#########################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather and process search bases #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#########################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /a/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ %base = getCounterHashFromFile($BASE);
|
|
|
dc8c34 |
+ @basekeys = keys %base;
|
|
|
dc8c34 |
+ $base_count = $#basekeys + 1;
|
|
|
dc8c34 |
+ if ($base_count > 0){
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Search Bases -----\n\n";
|
|
|
dc8c34 |
+ print "Number of Unique Search Bases: $base_count\n\n";
|
|
|
dc8c34 |
+ $basecount = 0;
|
|
|
dc8c34 |
+ foreach $bas (sort { $base{$b} <=> $base{$a} } keys %base) {
|
|
|
dc8c34 |
+ if ($basecount < $sizeCount){
|
|
|
dc8c34 |
+ printf "%-8s %-40s\n", $base{ $bas },$bas;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $basecount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %base;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#########################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather and process search filters #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#########################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /l/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ %filter = getCounterHashFromFile($FILTER);
|
|
|
dc8c34 |
+ @filterkeys = keys %filter;
|
|
|
dc8c34 |
+ $filter_count = $#filterkeys + 1;
|
|
|
dc8c34 |
+ if ($filter_count > 0){
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Search Filters -----\n";
|
|
|
dc8c34 |
+ print "\nNumber of Unique Search Filters: $filter_count\n\n";
|
|
|
dc8c34 |
+ $filtercount = 0;
|
|
|
dc8c34 |
+ foreach $filt (sort { $filter{$b} <=> $filter{$a} } keys %filter){
|
|
|
dc8c34 |
+ if ($filtercount < $sizeCount){
|
|
|
dc8c34 |
+ printf "%-8s %-40s\n", $filter{$filt}, $filt;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $filtercount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %filter;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#########################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather and Process the unique etimes #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#########################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /t/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ %etime = getCounterHashFromFile($ETIME);
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ # print most often etimes
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Most Frequent etimes -----\n\n";
|
|
|
dc8c34 |
+ $eloop = 0;
|
|
|
dc8c34 |
+ foreach $et (sort { $etime{$b} <=> $etime{$a} } keys %etime) {
|
|
|
dc8c34 |
+ if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
+ if ($retime ne "2"){
|
|
|
dc8c34 |
+ $first = $et;
|
|
|
dc8c34 |
+ $retime = "2";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ printf "%-8s %-12s\n", $etime{ $et }, "etime=$et";
|
|
|
dc8c34 |
+ $eloop++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ # print longest etimes
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Longest etimes -----\n\n";
|
|
|
dc8c34 |
+ $eloop = 0;
|
|
|
dc8c34 |
+ foreach $et (sort { $b <=> $a } (keys %etime)) {
|
|
|
dc8c34 |
+ if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
+ printf "%-12s %-10s\n","etime=$et",$etime{ $et };
|
|
|
dc8c34 |
+ $eloop++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %etime;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather and Process unique nentries #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /n/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ %nentries = getCounterHashFromFile($NENTRIES);
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Largest nentries -----\n\n";
|
|
|
dc8c34 |
+ $eloop = 0;
|
|
|
dc8c34 |
+ foreach $nentry (sort { $b <=> $a } (keys %nentries)){
|
|
|
dc8c34 |
+ if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
+ printf "%-18s %12s\n","nentries=$nentry", $nentries{ $nentry };
|
|
|
dc8c34 |
+ $eloop++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Most returned nentries -----\n\n";
|
|
|
dc8c34 |
+ $eloop = 0;
|
|
|
dc8c34 |
+ foreach $nentry (sort { $nentries{$b} <=> $nentries{$a} } (keys %nentries)){
|
|
|
dc8c34 |
+ if ($eloop == $sizeCount) { last; }
|
|
|
dc8c34 |
+ printf "%-12s %-14s\n", $nentries{ $nentry }, "nentries=$nentry";
|
|
|
dc8c34 |
+ $eloop++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "\n";
|
|
|
dc8c34 |
+ undef %nentries;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+##########################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Gather and process extended operations #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+##########################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /x/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ if ($extopCount > 0){
|
|
|
dc8c34 |
+ %oid = getCounterHashFromFile($OID);
|
|
|
dc8c34 |
+ print "\n\n----- Extended Operations -----\n\n";
|
|
|
dc8c34 |
+ foreach $oids (sort { $oid{$b} <=> $oid{$a} } (keys %oid) ){
|
|
|
dc8c34 |
+ if ($oids eq "2.16.840.1.113730.3.5.1"){ $oidmessage = "Transaction Request"} #depreciated?
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.2"){ $oidmessage = "Transaction Response"} #depreciated?
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.3"){ $oidmessage = "Start Replication Request (incremental update)"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.4"){ $oidmessage = "Replication Response"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.5"){ $oidmessage = "End Replication Request (incremental update)"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.6"){ $oidmessage = "Replication Entry Request"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.7"){ $oidmessage = "Start Bulk Import"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.8"){ $oidmessage = "Finished Bulk Import"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.9"){ $oidmessage = "DS71 Replication Entry Request"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.1"){ $oidmessage = "Incremental Update Replication Protocol"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.2"){ $oidmessage = "Total Update Replication Protocol (Initialization)"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.4.13"){ $oidmessage = "Replication Update Info Control"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.4"){ $oidmessage = "DS71 Replication Incremental Update Protocol"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.3"){ $oidmessage = "DS71 Replication Total Update Protocol"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.12"){ $oidmessage = "DS90 Start Replication Request"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.13"){ $oidmessage = "DS90 Replication Response"}
|
|
|
dc8c34 |
+ elsif ($oids eq "1.2.840.113556.1.4.841"){ $oidmessage = "Replication Dirsync Control"}
|
|
|
dc8c34 |
+ elsif ($oids eq "1.2.840.113556.1.4.417"){ $oidmessage = "Replication Return Deleted Objects"}
|
|
|
dc8c34 |
+ elsif ($oids eq "1.2.840.113556.1.4.1670"){ $oidmessage = "Replication WIN2K3 Active Directory"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.5"){ $oidmessage = "Replication CleanAllRUV"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.6"){ $oidmessage = "Replication Abort CleanAllRUV"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.7"){ $oidmessage = "Replication CleanAllRUV Get MaxCSN"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.6.8"){ $oidmessage = "Replication CleanAllRUV Check Status"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.10"){ $oidmessage = "DNA Plugin Request"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.5.11"){ $oidmessage = "DNA Plugin Response"}
|
|
|
dc8c34 |
+ elsif ($oids eq "1.3.6.1.4.1.1466.20037"){ $oidmessage = "Start TLS"}
|
|
|
dc8c34 |
+ elsif ($oids eq "1.3.6.1.4.1.4203.1.11.1"){ $oidmessage = "Password Modify"}
|
|
|
dc8c34 |
+ elsif ($oids eq "2.16.840.1.113730.3.4.20"){ $oidmessage = "MTN Control Use One Backend"}
|
|
|
dc8c34 |
+ else {$oidmessage = "Other"}
|
|
|
dc8c34 |
+ printf "%-6s %-23s %-60s\n", $oid{ $oids }, $oids, $oidmessage;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %oid;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+############################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Print most commonly requested attributes #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+############################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /r/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ if ($anyAttrs > 0){
|
|
|
dc8c34 |
+ %attr = getCounterHashFromFile($ATTR);
|
|
|
dc8c34 |
+ print "\n\n----- Top $sizeCount Most Requested Attributes -----\n\n";
|
|
|
dc8c34 |
+ $eloop = 0;
|
|
|
dc8c34 |
+ foreach $mostAttr (sort { $attr{$b} <=> $attr{$a} } (keys %attr) ){
|
|
|
dc8c34 |
+ if ($eloop eq $sizeCount){ last; }
|
|
|
dc8c34 |
+ printf "%-10s %-19s\n", $attr{$mostAttr}, $mostAttr;
|
|
|
dc8c34 |
+ $eloop++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ undef %attr;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#############################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# abandoned operation stats #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#############################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /g/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ $abandonTotal = $srchCount + $delCount + $modCount + $addCount + $modrdnCount + $bindCount + $extopCount + $cmpCount;
|
|
|
dc8c34 |
+ if ($verb eq "yes" && $abandonCount > 0 && $abandonTotal > 0){
|
|
|
dc8c34 |
+ %conn_hash = getHashFromFile($CONN_HASH);
|
|
|
dc8c34 |
+ @srchConn = getArrayFromFile($SRCH_CONN);
|
|
|
dc8c34 |
+ @srchOp = getArrayFromFile($SRCH_OP);
|
|
|
dc8c34 |
+ @delConn = getArrayFromFile($DEL_CONN);
|
|
|
dc8c34 |
+ @delOp = getArrayFromFile($DEL_OP);
|
|
|
dc8c34 |
+ @targetConn = getArrayFromFile($TARGET_CONN);
|
|
|
dc8c34 |
+ @targetOp = getArrayFromFile($TARGET_OP);
|
|
|
dc8c34 |
+ @msgid = getArrayFromFile($MSGID);
|
|
|
dc8c34 |
+ @addConn = getArrayFromFile($ADD_CONN);
|
|
|
dc8c34 |
+ @addOp = getArrayFromFile($ADD_OP);
|
|
|
dc8c34 |
+ @modConn = getArrayFromFile($MOD_CONN);
|
|
|
dc8c34 |
+ @modOp = getArrayFromFile($MOD_OP);
|
|
|
dc8c34 |
+ @cmpConn = getArrayFromFile($CMP_CONN);
|
|
|
dc8c34 |
+ @cmpOp = getArrayFromFile($CMP_OP);
|
|
|
dc8c34 |
+ @modrdnConn = getArrayFromFile($MODRDN_CONN);
|
|
|
dc8c34 |
+ @modrdnOp = getArrayFromFile($MODRDN_OP);
|
|
|
dc8c34 |
+ @bindConn = getArrayFromFile($BIND_CONN);
|
|
|
dc8c34 |
+ @bindOp = getArrayFromFile($BIND_OP);
|
|
|
dc8c34 |
+ @unbindConn = getArrayFromFile($UNBIND_CONN);
|
|
|
dc8c34 |
+ @unbindOp = getArrayFromFile($UNBIND_OP);
|
|
|
dc8c34 |
+ @extConn = getArrayFromFile($EXT_CONN);
|
|
|
dc8c34 |
+ @extOp = getArrayFromFile($EXT_OP);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print "\n\n----- Abandon Request Stats -----\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ for ($g = 0; $g < $abandonCount; $g++){
|
|
|
dc8c34 |
+ for ($sc = 0; $sc < $srchCount; $sc++){
|
|
|
dc8c34 |
+ if ($srchConn[$sc] eq $targetConn[$g] && $srchOp[$sc] eq $targetOp[$g] ){
|
|
|
dc8c34 |
+ print " - SRCH conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($dc = 0; $dc < $delCount; $dc++){
|
|
|
dc8c34 |
+ if ($delConn[$dc] eq $targetConn[$g] && $delOp[$dc] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - DEL conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($adc = 0; $adc < $addCount; $adc++){
|
|
|
dc8c34 |
+ if ($addConn[$adc] eq $targetConn[$g] && $addOp[$adc] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - ADD conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($mc = 0; $mc < $modCount; $mc++){
|
|
|
dc8c34 |
+ if ($modConn[$mc] eq $targetConn[$g] && $modOp[$mc] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - MOD conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($cc = 0; $cc < $cmpCount; $cc++){
|
|
|
dc8c34 |
+ if ($cmpConn[$mdc] eq $targetConn[$g] && $cmpOp[$mdc] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - CMP conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($mdc = 0; $mdc < $modrdnCount; $mdc++){
|
|
|
dc8c34 |
+ if ($modrdnConn[$mdc] eq $targetConn[$g] && $modrdnOp[$mdc] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - MODRDN conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($bcb = 0; $bcb < $bindCount; $bcb++){
|
|
|
dc8c34 |
+ if ($bindConn[$bcb] eq $targetConn[$g] && $bindOp[$bcb] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - BIND conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($ubc = 0; $ubc < $unbindCount; $ubc++){
|
|
|
dc8c34 |
+ if ($unbindConn[$ubc] eq $targetConn[$g] && $unbindOp[$ubc] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - UNBIND conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($ec = 0; $ec < $extopCount; $ec++){
|
|
|
dc8c34 |
+ if ($extConn[$ec] eq $targetConn[$g] && $extOp[$ec] eq $targetOp[$g]){
|
|
|
dc8c34 |
+ print " - EXT conn=$targetConn[$g] op=$targetOp[$g] msgid=$msgid[$g] client=$conn_hash{$targetConn[$g]}\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+print "\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Recommendations #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+if ($usage =~ /j/i || $verb eq "yes"){
|
|
|
dc8c34 |
+ %conncount = getCounterHashFromFile($CONNCOUNT);
|
|
|
dc8c34 |
+ print "\n----- Recommendations -----\n";
|
|
|
dc8c34 |
+ $recCount = "1";
|
|
|
dc8c34 |
+ if ($unindexedSrchCount > 0){
|
|
|
dc8c34 |
+ print "\n $recCount. You have unindexed searches, this can be caused from a search on an unindexed attribute, or your returned results exceeded the allidsthreshold. Unindexed searches are not recommended. To refuse unindexed searches, switch \'nsslapd-require-index\' to \'on\' under your database entry (e.g. cn=UserRoot,cn=ldbm database,cn=plugins,cn=config).\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($conncount{"T1"} > 0){
|
|
|
dc8c34 |
+ print "\n $recCount. You have some connections that are are being closed by the idletimeout setting. You may want to increase the idletimeout if it is set low.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($conncount{"T2"} > 0){
|
|
|
dc8c34 |
+ print "\n $recCount. You have some coonections that are being closed by the ioblocktimeout setting. You may want to increase the ioblocktimeout.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ # compare binds to unbinds, if the difference is more than 30% of the binds, then report a issue
|
|
|
dc8c34 |
+ if (($bindCount - $unbindCount) > ($bindCount*.3)){
|
|
|
dc8c34 |
+ print "\n $recCount. You have a significant difference between binds and unbinds. You may want to investigate this difference.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ # compare fds taken and return, if the difference is more than 30% report a issue
|
|
|
dc8c34 |
+ if (($fdTaken -$fdReturned) > ($fdTaken*.3)){
|
|
|
dc8c34 |
+ print "\n $recCount. You have a significant difference between file descriptors taken and file descriptors returned. You may want to investigate this difference.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($rootDNBindCount > ($bindCount *.2)){
|
|
|
dc8c34 |
+ print "\n $recCount. You have a high number of Directory Manager binds. The Directory Manager account should only be used under certain circumstances. Avoid using this account for client applications.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($errorCount > $successCount){
|
|
|
dc8c34 |
+ print "\n $recCount. You have more unsuccessful operations than successful operations. You should investigate this difference.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($conncount{"U1"} < ($connCodeCount - $conncount{"U1"})){
|
|
|
dc8c34 |
+ print "\n $recCount. You have more abnormal connection codes than cleanly closed connections. You may want to investigate this difference.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($first > 0){
|
|
|
dc8c34 |
+ print "\n $recCount. You have a majority of etimes that are greater than zero, you may want to investigate this performance problem.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($objectclassTopCount > ($srchCount *.25)){
|
|
|
dc8c34 |
+ print "\n $recCount. You have a high number of searches that query the entire search base. Although this is not necessarily bad, it could be resource intensive if the search base contains many entries.\n";
|
|
|
dc8c34 |
+ $recCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($recCount == 1){
|
|
|
dc8c34 |
+ print "\nNone.\n";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "\n";
|
|
|
dc8c34 |
+ undef %conncount;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+# We're done, clean up the data files
|
|
|
dc8c34 |
+#
|
|
|
dc8c34 |
+removeDataFiles();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+exit (0);
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Display Usage #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub displayUsage {
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print "Usage:\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print " ./logconv.pl [-h] [-d|--rootdn <rootDN>] [-s|--sizeLimit <size limit>] [-v|verison] [-Vi|verbose]\n";
|
|
|
dc8c34 |
+ print " [-S|--startTime <start time>] [-E|--endTime <end time>] \n";
|
|
|
dc8c34 |
+ print " [-efcibaltnxrgjuyp] [ access log ... ... ]\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print "- Commandline Switches:\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print " -h, --help help/usage\n";
|
|
|
dc8c34 |
+ print " -d, --rootDN <Directory Managers DN> default is \"cn=directory manager\"\n";
|
|
|
dc8c34 |
+ print " -D, --data <Location for temporary data files> default is \"/tmp\"\n";
|
|
|
dc8c34 |
+ print " -s, --sizeLimit <Number of results to return per catagory> default is 20\n";
|
|
|
dc8c34 |
+ print " -X, --excludeIP <IP address to exclude from connection stats> E.g. Load balancers\n";
|
|
|
dc8c34 |
+ print " -v, --version show version of tool\n";
|
|
|
dc8c34 |
+ print " -S, --startTime <time to begin analyzing logfile from>\n";
|
|
|
dc8c34 |
+ print " E.g. \"[28/Mar/2002:13:14:22 -0800]\"\n";
|
|
|
dc8c34 |
+ print " -E, --endTime <time to stop analyzing logfile>\n";
|
|
|
dc8c34 |
+ print " E.g. \"[28/Mar/2002:13:24:62 -0800]\"\n";
|
|
|
dc8c34 |
+ print " -m, --reportFileSecs <CSV output file - per second stats>\n";
|
|
|
dc8c34 |
+ print " -M, --reportFileMins <CSV output file - per minute stats>\n";
|
|
|
dc8c34 |
+ print " -B, --bind <ALL | ANONYMOUS | \"Actual Bind DN\">\n";
|
|
|
dc8c34 |
+ print " -V, --verbose <enable verbose output - includes all stats listed below>\n";
|
|
|
dc8c34 |
+ print " -[efcibaltnxrgjuyp]\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print " e Error Code stats\n";
|
|
|
dc8c34 |
+ print " f Failed Login Stats\n";
|
|
|
dc8c34 |
+ print " c Connection Code Stats\n";
|
|
|
dc8c34 |
+ print " i Client Stats\n";
|
|
|
dc8c34 |
+ print " b Bind Stats\n";
|
|
|
dc8c34 |
+ print " a Search Base Stats\n";
|
|
|
dc8c34 |
+ print " l Search Filter Stats\n";
|
|
|
dc8c34 |
+ print " t Etime Stats\n";
|
|
|
dc8c34 |
+ print " n Nentries Stats\n";
|
|
|
dc8c34 |
+ print " x Extended Operations\n";
|
|
|
dc8c34 |
+ print " r Most Requested Attribute Stats\n";
|
|
|
dc8c34 |
+ print " g Abandoned Operation Stats\n";
|
|
|
dc8c34 |
+ print " j Recommendations\n";
|
|
|
dc8c34 |
+ print " u Unindexed Search Stats\n";
|
|
|
dc8c34 |
+ print " y Connection Latency Stats\n";
|
|
|
dc8c34 |
+ print " p Open Connection ID Stats\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print " Examples:\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print " ./logconv.pl -s 10 -V /logs/access*\n\n";
|
|
|
dc8c34 |
+ print " ./logconv.pl --rootDN cn=dm /logs/access*\n\n";
|
|
|
dc8c34 |
+ print " ./logconv.pl --sizeLimit 50 -ibgju /logs/access*\n\n";
|
|
|
dc8c34 |
+ print " ./logconv.pl -S \"\[28/Mar/2002:13:14:22 -0800\]\" --endTime \"\[28/Mar/2002:13:50:05 -0800\]\" -e /logs/access*\n\n";
|
|
|
dc8c34 |
+ print " ./logconv.pl -m log-minute-stats-csv.out /logs/access*\n\n";
|
|
|
dc8c34 |
+ print " ./logconv.pl -B ANONYMOUS /logs/access*\n\n";
|
|
|
dc8c34 |
+ print " ./logconv.pl -B \"uid=mreynolds,dc=example,dc=com\" /logs/access*\n\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ exit 1;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+######################################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Parsing Routines That Do The Actual Parsing Work #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+######################################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+parseLine {
|
|
|
dc8c34 |
+ if($reportBinds eq "yes"){
|
|
|
dc8c34 |
+ &parseLineBind();
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ &parseLineNormal();
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+parseLineBind {
|
|
|
dc8c34 |
+ $linesProcessed++;
|
|
|
dc8c34 |
+ $lineBlockCount++;
|
|
|
dc8c34 |
+ local $_ = $logline;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if ($lineBlockCount >= $limit){
|
|
|
dc8c34 |
+ print STDERR sprintf" %10s Lines Processed\n",$linesProcessed;
|
|
|
dc8c34 |
+ $lineBlockCount="0";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # skip blank lines
|
|
|
dc8c34 |
+ return if $_ =~ /^\s/;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if($firstFile == 1 && $_ =~ /^\[/){
|
|
|
dc8c34 |
+ $start = $_;
|
|
|
dc8c34 |
+ if ($start =~ / *([0-9a-z:\/]+)/i){$start=$1;}
|
|
|
dc8c34 |
+ $firstFile = 0;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($endFlag != 1 && $_ =~ /^\[/ && $_ =~ / *([0-9a-z:\/]+)/i){
|
|
|
dc8c34 |
+ $end =$1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($startTime && !$startFlag) {
|
|
|
dc8c34 |
+ if (index($_, $startTime) == 0) {
|
|
|
dc8c34 |
+ $startFlag = 1;
|
|
|
dc8c34 |
+ ($start) = $startTime =~ /\D*(\S*)/;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($endTime && !$endFlag) {
|
|
|
dc8c34 |
+ if (index($_, $endTime) == 0) {
|
|
|
dc8c34 |
+ $endFlag = 1;
|
|
|
dc8c34 |
+ ($end) = $endTime =~ /\D*(\S*)/;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ) {
|
|
|
dc8c34 |
+ for ($excl =0; $excl <= $#excludeIP; $excl++){
|
|
|
dc8c34 |
+ if ($excludeIP[$excl] eq $1){
|
|
|
dc8c34 |
+ $skip = "yes";
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($skip eq "yes"){
|
|
|
dc8c34 |
+ return ;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $ip = $1;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i ){
|
|
|
dc8c34 |
+ $connList{$ip} = $connList{$ip} . " $1 ";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
|
|
|
dc8c34 |
+ if ($1 eq ""){
|
|
|
dc8c34 |
+ $dn = "Anonymous";
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $dn = $1;
|
|
|
dc8c34 |
+ $dn =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if($bindReportDN ne ""){
|
|
|
dc8c34 |
+ if($dn ne $bindReportDN){
|
|
|
dc8c34 |
+ # We are not looking for this DN, skip it
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $bindReport{$dn}{"binds"}++;
|
|
|
dc8c34 |
+ if ($bindReport{$dn}{"binds"} == 1){
|
|
|
dc8c34 |
+ # For hashes we need to init the counters
|
|
|
dc8c34 |
+ $bindReport{$dn}{"srch"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"add"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"mod"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"del"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"cmp"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"ext"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"modrdn"} = 0;
|
|
|
dc8c34 |
+ $bindReport{$dn}{"failedBind"} = 0;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $bindReport{$dn}{"conn"} = $bindReport{$dn}{"conn"} . " $1 ";
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (/ RESULT err=49 /){
|
|
|
dc8c34 |
+ processOpForBindReport("failedBind",$logline);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (/ SRCH base=/){
|
|
|
dc8c34 |
+ processOpForBindReport("srch",$logline);
|
|
|
dc8c34 |
+ } elsif (/ ADD dn=/){
|
|
|
dc8c34 |
+ processOpForBindReport("add",$logline);
|
|
|
dc8c34 |
+ } elsif (/ MOD dn=/){
|
|
|
dc8c34 |
+ processOpForBindReport("mod",$logline);
|
|
|
dc8c34 |
+ } elsif (/ DEL dn=/){
|
|
|
dc8c34 |
+ processOpForBindReport("del",$logline);
|
|
|
dc8c34 |
+ } elsif (/ MODRDN dn=/){
|
|
|
dc8c34 |
+ processOpForBindReport("modrdn",$logline);
|
|
|
dc8c34 |
+ } elsif (/ CMP dn=/){
|
|
|
dc8c34 |
+ processOpForBindReport("cmp",$logline);
|
|
|
dc8c34 |
+ } elsif (/ EXT oid=/){
|
|
|
dc8c34 |
+ processOpForBindReport("ext",$logline);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+processOpForBindReport
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $op = @_[0];
|
|
|
dc8c34 |
+ $data = @_[1];
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if ($data =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ foreach $dn (keys %bindReport){
|
|
|
dc8c34 |
+ if ($bindReport{$dn}{"conn"} =~ / $1 /){
|
|
|
dc8c34 |
+ $bindDN = $dn;
|
|
|
dc8c34 |
+ $bindReport{$bindDN}{$op}++;
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub parseLineNormal
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ local $_ = $logline;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # lines starting blank are restart
|
|
|
dc8c34 |
+ return if $_ =~ /^\s/;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $linesProcessed++;
|
|
|
dc8c34 |
+ $lineBlockCount++;
|
|
|
dc8c34 |
+ if ($lineBlockCount >= $limit){ print STDERR sprintf" %10s Lines Processed\n",$linesProcessed; $lineBlockCount="0";}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # gather/process the timestamp
|
|
|
dc8c34 |
+ if($firstFile == 1 && $_ =~ /^\[/){
|
|
|
dc8c34 |
+ # if we are using startTime & endTime, this will get overwritten, which is ok
|
|
|
dc8c34 |
+ $start = $_;
|
|
|
dc8c34 |
+ if ($start =~ / *([0-9a-z:\/]+)/i){$start=$1;}
|
|
|
dc8c34 |
+ $firstFile = 0;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($endFlag != 1 && $_ =~ /^\[/ && $_ =~ / *([0-9a-z:\/]+)/i){$end =$1;}
|
|
|
dc8c34 |
+ if ($startTime && !$startFlag) {
|
|
|
dc8c34 |
+ if (index($_, $startTime) == 0) {
|
|
|
dc8c34 |
+ $startFlag = 1;
|
|
|
dc8c34 |
+ ($start) = $startTime =~ /\D*(\S*)/;
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($endTime && !$endFlag) {
|
|
|
dc8c34 |
+ if (index($_, $endTime) == 0) {
|
|
|
dc8c34 |
+ $endFlag = 1;
|
|
|
dc8c34 |
+ ($end) = $endTime =~ /\D*(\S*)/;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # Additional performance stats
|
|
|
dc8c34 |
+ ($time, $tzone) = split (' ', $_);
|
|
|
dc8c34 |
+ if ($reportStat && $time ne $last_tm)
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ $last_tm = $time;
|
|
|
dc8c34 |
+ $time =~ s/\[//;
|
|
|
dc8c34 |
+ $tzone =~ s/\].*//;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if($tzone ne $lastzone)
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ # tz offset change
|
|
|
dc8c34 |
+ $lastzone=$tzone;
|
|
|
dc8c34 |
+ ($sign,$hr,$min) = $tzone =~ m/(?)(\d\d)(\d\d)/;
|
|
|
dc8c34 |
+ $tzoff = $hr*3600 + $min*60;
|
|
|
dc8c34 |
+ $tzoff *= -1
|
|
|
dc8c34 |
+ if $sign eq '-';
|
|
|
dc8c34 |
+ # to be subtracted from converted values.
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ ($date, $hr, $min, $sec) = split (':', $time);
|
|
|
dc8c34 |
+ ($day, $mon, $yr) = split ('/', $date);
|
|
|
dc8c34 |
+ $newmin = timegm(0, $min, $hours, $day, $monthname{$mon}, $yr) - $tzoff;
|
|
|
dc8c34 |
+ $gmtime = $newmin + $sec;
|
|
|
dc8c34 |
+ print_stats_block( $s_stats );
|
|
|
dc8c34 |
+ reset_stats_block( $s_stats, $gmtime, $time.' '.$tzone );
|
|
|
dc8c34 |
+ if ($newmin != $last_min)
|
|
|
dc8c34 |
+ {
|
|
|
dc8c34 |
+ print_stats_block( $m_stats );
|
|
|
dc8c34 |
+ $time =~ s/\d\d$/00/;
|
|
|
dc8c34 |
+ reset_stats_block( $m_stats, $newmin, $time.' '.$tzone );
|
|
|
dc8c34 |
+ $last_min = $newmin;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if (m/ RESULT err/){
|
|
|
dc8c34 |
+ $allResults++;
|
|
|
dc8c34 |
+ if($reportStat){ 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 ($_ =~ / attrs=\"(.*)\"/i){
|
|
|
dc8c34 |
+ $anyAttrs++;
|
|
|
dc8c34 |
+ $attrs = $1 . " ";
|
|
|
dc8c34 |
+ while ($attrs =~ /(\S+)\s/g){
|
|
|
dc8c34 |
+ writeFile($ATTR, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (/ attrs=ALL/){
|
|
|
dc8c34 |
+ writeFile($ATTR, "All Attributes");
|
|
|
dc8c34 |
+ $anyAttrs++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($verb eq "yes"){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ writeFile($SRCH_CONN, $1);}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ writeFile($SRCH_OP, $1);}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ DEL/){
|
|
|
dc8c34 |
+ $delCount++;
|
|
|
dc8c34 |
+ if($reportStat){ 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 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ MOD dn=/){
|
|
|
dc8c34 |
+ $modCount++;
|
|
|
dc8c34 |
+ if($reportStat){ 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 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ ADD/){
|
|
|
dc8c34 |
+ $addCount++;
|
|
|
dc8c34 |
+ if($reportStat){ 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 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ MODRDN/){
|
|
|
dc8c34 |
+ $modrdnCount++;
|
|
|
dc8c34 |
+ if($reportStat){ 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 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ CMP dn=/){
|
|
|
dc8c34 |
+ $cmpCount++;
|
|
|
dc8c34 |
+ if($reportStat){ 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 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ ABANDON /){
|
|
|
dc8c34 |
+ $abandonCount++;
|
|
|
dc8c34 |
+ if($reportStat){ inc_stats('abandon',$s_stats,$m_stats); }
|
|
|
dc8c34 |
+ $allResults++;
|
|
|
dc8c34 |
+ if ($_ =~ /targetop= *([0-9a-zA-Z]+)/i ){
|
|
|
dc8c34 |
+ writeFile($TARGET_OP, $1);
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ writeFile($TARGET_CONN, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /msgid= *([0-9]+)/i){ writeFile($MSGID, $1);}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ VLV /){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ $vlvconn[$vlvCount] = $1;}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ $vlvop[$vlvCount] = $1;}
|
|
|
dc8c34 |
+ $vlvCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ authzid=/){
|
|
|
dc8c34 |
+ $proxiedAuthCount++;
|
|
|
dc8c34 |
+ }
|
|
|
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/ SSL connection from/){$sslCount++;}
|
|
|
dc8c34 |
+ if (m/ connection from/){
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ if ($_ =~ /connection from *([0-9A-Fa-f\.\:]+)/i ){
|
|
|
dc8c34 |
+ for ($xxx =0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($excludeIP[$xxx] eq $1){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){ $connectionCount++;}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $simConnection++;
|
|
|
dc8c34 |
+ if ($simConnection > $maxsimConnection) {
|
|
|
dc8c34 |
+ $maxsimConnection = $simConnection;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ ($connID) = $_ =~ /conn=(\d*)\s/;
|
|
|
dc8c34 |
+ $openConnection[$connID]++;
|
|
|
dc8c34 |
+ ($time, $tzone) = split (' ', $_);
|
|
|
dc8c34 |
+ ($date, $hr, $min, $sec) = split (':', $time);
|
|
|
dc8c34 |
+ ($day, $mon, $yr) = split ('/', $date);
|
|
|
dc8c34 |
+ $day =~ s/\[//;
|
|
|
dc8c34 |
+ $start_time_of_connection[$connID] = timegm($sec, $min, $hours, $day, $monthname{$mon}, $yr);
|
|
|
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 |
+ $end_time_of_connection[$connID] = $gmtime;
|
|
|
dc8c34 |
+ $diff = $end_time_of_connection[$connID] - $start_time_of_connection[$connID];
|
|
|
dc8c34 |
+ $start_time_of_connection[$connID] = $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 |
+ if (m/ BIND/ && $_ =~ /dn=\"(.*)\" method/i ){
|
|
|
dc8c34 |
+ if($reportStat){ inc_stats('bind',$s_stats,$m_stats); }
|
|
|
dc8c34 |
+ $bindCount++;
|
|
|
dc8c34 |
+ if ($1 ne ""){
|
|
|
dc8c34 |
+ $tmpp = $1;
|
|
|
dc8c34 |
+ $tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
+ writeFile($BINDLIST, $tmpp);
|
|
|
dc8c34 |
+ $bindVal = $tmpp;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) { $bindConn = $1; writeFile($BIND_CONN, $1);}
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i) { $bindOp = $1; writeFile($BIND_OP, $1);}
|
|
|
dc8c34 |
+ if($usage =~ /f/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ # only need this for the failed bind report
|
|
|
dc8c34 |
+ writeFile($BINDINFO, "$bindVal ,, $bindConn ,, $bindOp");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if($1 eq $rootDN){
|
|
|
dc8c34 |
+ $rootDNBindCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $anonymousBindCount++;
|
|
|
dc8c34 |
+ writeFile($BINDLIST, "Anonymous Binds");
|
|
|
dc8c34 |
+ inc_stats('anonbind',$s_stats,$m_stats);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ UNBIND/){
|
|
|
dc8c34 |
+ $unbindCount++;
|
|
|
dc8c34 |
+ if ($verb eq "yes"){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ writeFile($UNBIND_CONN, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ writeFile($UNBIND_OP, $1); }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ RESULT err=/ && m/ notes=P/){
|
|
|
dc8c34 |
+ $pagedSearchCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ notes=U/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){
|
|
|
dc8c34 |
+ $con = $1;
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ $op = $1;}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ for ($i=0; $i <= $vlvCount;$i++){
|
|
|
dc8c34 |
+ if ($vlvconn[$i] eq $con && $vlvop[$i] eq $op){ $vlvNotesCount++; $isVlvNotes="1";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if($isVlvNotes == 0){
|
|
|
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 |
+ }
|
|
|
dc8c34 |
+ if ($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ if ($isVlvNnotes == 0 ){
|
|
|
dc8c34 |
+ if ($_ =~ /etime= *([0-9.]+)/i ){
|
|
|
dc8c34 |
+ writeFile($NOTES_ETIME, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){
|
|
|
dc8c34 |
+ writeFile($NOTES_CONN, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){
|
|
|
dc8c34 |
+ writeFile($NOTES_OP, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ / *([0-9a-z:\/]+)/i){
|
|
|
dc8c34 |
+ writeFile($NOTES_TIME, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /nentries= *([0-9]+)/i ){
|
|
|
dc8c34 |
+ writeFile($NOTES_NENTRIES, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $isVlvNotes = 0;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ closed error 32/){
|
|
|
dc8c34 |
+ $brokenPipeCount++;
|
|
|
dc8c34 |
+ if (m/- T1/){ writeFile($RC,"T1"); }
|
|
|
dc8c34 |
+ elsif (m/- T2/){ writeFile($RC,"T2"); }
|
|
|
dc8c34 |
+ elsif (m/- A1/){ writeFile($RC,"A1"); }
|
|
|
dc8c34 |
+ elsif (m/- B1/){ writeFile($RC,"B1"); }
|
|
|
dc8c34 |
+ elsif (m/- B4/){ writeFile($RC,"B4"); }
|
|
|
dc8c34 |
+ elsif (m/- B2/){ writeFile($RC,"B2"); }
|
|
|
dc8c34 |
+ elsif (m/- B3/){ writeFile($RC,"B3"); }
|
|
|
dc8c34 |
+ elsif (m/- R1/){ writeFile($RC,"R1"); }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ writeFile($RC,"P1"); }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ writeFile($RC,"P2"); }
|
|
|
dc8c34 |
+ elsif (m/- U1/){ writeFile($RC,"U1"); }
|
|
|
dc8c34 |
+ else { writeFile($RC,"other"); }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ closed error 131/ || m/ closed error -5961/){
|
|
|
dc8c34 |
+ $connResetByPeerCount++;
|
|
|
dc8c34 |
+ if (m/- T1/){ writeFile($SRC,"T1"); }
|
|
|
dc8c34 |
+ elsif (m/- T2/){ writeFile($SRC,"T2"); }
|
|
|
dc8c34 |
+ elsif (m/- A1/){ writeFile($SRC,"A1"); }
|
|
|
dc8c34 |
+ elsif (m/- B1/){ writeFile($SRC,"B1"); }
|
|
|
dc8c34 |
+ elsif (m/- B4/){ writeFile($SRC,"B4"); }
|
|
|
dc8c34 |
+ elsif (m/- B2/){ writeFile($SRC,"B2"); }
|
|
|
dc8c34 |
+ elsif (m/- B3/){ writeFile($SRC,"B3"); }
|
|
|
dc8c34 |
+ elsif (m/- R1/){ writeFile($SRC,"R1"); }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ writeFile($SRC,"P1"); }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ writeFile($SRC,"P2"); }
|
|
|
dc8c34 |
+ elsif (m/- U1/){ writeFile($SRC,"U1"); }
|
|
|
dc8c34 |
+ else { writeFile($SRC,"other"); }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ closed error 11/){
|
|
|
dc8c34 |
+ $resourceUnavailCount++;
|
|
|
dc8c34 |
+ if (m/- T1/){ writeFile($RSRC,"T1"); }
|
|
|
dc8c34 |
+ elsif (m/- T2/){ writeFile($RSRC,"T2"); }
|
|
|
dc8c34 |
+ elsif (m/- A1/){ writeFile($RSRC,"A1"); }
|
|
|
dc8c34 |
+ elsif (m/- B1/){ writeFile($RSRC,"B1"); }
|
|
|
dc8c34 |
+ elsif (m/- B4/){ writeFile($RSRC,"B4"); }
|
|
|
dc8c34 |
+ elsif (m/- B2/){ writeFile($RSRC,"B2"); }
|
|
|
dc8c34 |
+ elsif (m/- B3/){ writeFile($RSRC,"B3"); }
|
|
|
dc8c34 |
+ elsif (m/- R1/){ writeFile($RSRC,"R1"); }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ writeFile($RSRC,"P1"); }
|
|
|
dc8c34 |
+ elsif (m/- P1/){ writeFile($RSRC,"P2"); }
|
|
|
dc8c34 |
+ elsif (m/- U1/){ writeFile($RSRC,"U1"); }
|
|
|
dc8c34 |
+ else { writeFile($RSRC,"other"); }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($usage =~ /g/ || $usage =~ /c/ || $usage =~ /i/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ if ($_ =~ /connection from *([0-9A-fa-f\.\:]+)/i ) {
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($1 eq $excludeIP[$xxx]){
|
|
|
dc8c34 |
+ $exc = "yes";
|
|
|
dc8c34 |
+ writeFile($EXCOUNT,$1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $ip = $1;
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip count");
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i ){
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($CONN_HASH, "$1 $ip");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- A1/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip A1");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "A1");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- B1/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip B1");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "B1");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- B4/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip B4");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "B4");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- T1/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip T1");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "T1");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- T2/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip T2");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "T2");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- B2/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ $maxBerSizeCount++;
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip B2");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "B2");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- B3/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip B3");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "B3");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- R1/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip R1");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "R1");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- P1/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip P1");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "P1");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- P2/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip P2");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "P2");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/- U1/){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $exc = "no";
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ if ($ip eq ""){$ip = "Unknown_Host";}
|
|
|
dc8c34 |
+ for ($xxx = 0; $xxx <= $#excludeIP; $xxx++){
|
|
|
dc8c34 |
+ if ($ip eq $excludeIP[$xxx]){$exc = "yes";}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($exc ne "yes"){
|
|
|
dc8c34 |
+ writeFile($IP_HASH, "$ip U1");
|
|
|
dc8c34 |
+ writeFile($CONNCOUNT, "U1");
|
|
|
dc8c34 |
+ $connCodeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /err= *([0-9]+)/i){
|
|
|
dc8c34 |
+ $errorCode[$1]++;
|
|
|
dc8c34 |
+ if ($1 ne "0"){ $errorCount++;}
|
|
|
dc8c34 |
+ else { $successCount++;}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /etime= *([0-9.]+)/ ) { writeFile($ETIME, $1);}
|
|
|
dc8c34 |
+ if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){
|
|
|
dc8c34 |
+ if ($_ =~ / nentries= *([0-9]+)/i ){ writeFile($NENTRIES, $1); }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/objectclass=\*/i || m/objectclass=top/i ){
|
|
|
dc8c34 |
+ if (m/ scope=2 /){ $objectclassTopCount++;}
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (m/ EXT oid=/){
|
|
|
dc8c34 |
+ $extopCount++;
|
|
|
dc8c34 |
+ if ($_ =~ /oid=\" *([0-9\.]+)/i ){ writeFile($OID,$1); }
|
|
|
dc8c34 |
+ if ($verb eq "yes"){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i){ writeFile($EXT_CONN, $1); }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i){ writeFile($EXT_OP, $1); }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($usage =~ /l/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ if (/ SRCH / && / attrs=/ && $_ =~ /filter=\"(.*)\" /i ){
|
|
|
dc8c34 |
+ $tmpp = $1;
|
|
|
dc8c34 |
+ $tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
+ $tmpp =~ s/\\22/\"/g;
|
|
|
dc8c34 |
+ writeFile($FILTER, $tmpp);
|
|
|
dc8c34 |
+ $filterVal = $tmpp;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) { $filterConn = $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i) { $filterOp = $1; }
|
|
|
dc8c34 |
+ } elsif (/ SRCH / && $_ =~ /filter=\"(.*)\"/i){
|
|
|
dc8c34 |
+ $tmpp = $1;
|
|
|
dc8c34 |
+ $tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
+ $tmpp =~ s/\\22/\"/g;
|
|
|
dc8c34 |
+ writeFile($FILTER, $tmpp);
|
|
|
dc8c34 |
+ $filterVal = $tmpp;
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) { $filterConn = $1; }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i) { $filterOp = $1; }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $filterCount++;
|
|
|
dc8c34 |
+ if($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ # we noly need this for the unindexed search report
|
|
|
dc8c34 |
+ writeFile($FILTERINFO, "$filterVal ,, $filterConn ,, $filterOp");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($usage =~ /a/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ if (/ SRCH / && $_ =~ /base=\"(.*)\" scope/i ){
|
|
|
dc8c34 |
+ if ($1 eq ""){
|
|
|
dc8c34 |
+ $tmpp = "Root DSE";
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $tmpp = $1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $tmpp =~ tr/A-Z/a-z/;
|
|
|
dc8c34 |
+ writeFile($BASE, $tmpp);
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ # grab the search bases & scope for potential unindexed searches
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ $baseVal = $tmpp;
|
|
|
dc8c34 |
+ if ($_ =~ /scope= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $scopeVal = $1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $baseConn = $1;
|
|
|
dc8c34 |
+ $scopeConn = $1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i) {
|
|
|
dc8c34 |
+ $baseOp = $1;
|
|
|
dc8c34 |
+ $scopeOp = $1;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if($usage =~ /u/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ # we noly need this for the unindexed search report
|
|
|
dc8c34 |
+ writeFile($BASEINFO, "$baseVal ,, $baseConn ,, $baseOp");
|
|
|
dc8c34 |
+ writeFile($SCOPEINFO, "$scopeVal ,, $scopeConn ,, $scopeOp");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $baseCount++;
|
|
|
dc8c34 |
+ $scopeCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /fd= *([0-9]+)/i ) {
|
|
|
dc8c34 |
+ $fds[$fdds] = $1;
|
|
|
dc8c34 |
+ if ($fds[$fdds] > $highestFdTaken) {$highestFdTaken = $fds[$fdds];}
|
|
|
dc8c34 |
+ $fdds++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($usage =~ /f/ || $verb eq "yes"){
|
|
|
dc8c34 |
+ if (/ err=49 tag=/ && / dn=\"/){
|
|
|
dc8c34 |
+ if ($_ =~ /dn=\"(.*)\"/i ){
|
|
|
dc8c34 |
+ writeFile($DS6XBADPWD, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ $ds6x = "true";
|
|
|
dc8c34 |
+ $badPwdCount++;
|
|
|
dc8c34 |
+ } elsif (/ err=49 tag=/ ){
|
|
|
dc8c34 |
+ if ($_ =~ /conn= *([0-9]+)/i ){
|
|
|
dc8c34 |
+ writeFile($BADPWDCONN, $1);
|
|
|
dc8c34 |
+ $ip = getIPfromConn($1);
|
|
|
dc8c34 |
+ $badPwdCount++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if ($_ =~ /op= *([0-9]+)/i ){
|
|
|
dc8c34 |
+ writeFile($BADPWDOP, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ writeFile($BADPWDIP, $ip);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (/ BIND / && /method=sasl/i){
|
|
|
dc8c34 |
+ $saslBindCount++;
|
|
|
dc8c34 |
+ if ($_ =~ /mech=(.*)/i ){
|
|
|
dc8c34 |
+ writeFile($SASLMECH, $1);
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ if (/ conn=Internal op=-1 / && !/ RESULT err=/){ $internalOpCount++; }
|
|
|
dc8c34 |
+ if (/ ENTRY dn=/ ){ $entryOpCount++; }
|
|
|
dc8c34 |
+ if (/ conn=/ && /op=/ && / REFERRAL/){ $referralCount++; }
|
|
|
dc8c34 |
+ if (/ options=persistent/){$persistentSrchCount++;}
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# CSV Helper Routines #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# To convert the CSV to chart in OO #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# * Select active rows and columns #
|
|
|
dc8c34 |
+# * Insert -> Chart #
|
|
|
dc8c34 |
+# * Chart type "XY (Scatter)" #
|
|
|
dc8c34 |
+# * sub-type "Lines Only" #
|
|
|
dc8c34 |
+# * select "Sort by X values" #
|
|
|
dc8c34 |
+# * "Next" #
|
|
|
dc8c34 |
+# * select "Data series in columns" #
|
|
|
dc8c34 |
+# * select "First row as label" #
|
|
|
dc8c34 |
+# * select "First column as label" #
|
|
|
dc8c34 |
+# * "Next" #
|
|
|
dc8c34 |
+# * "Next" #
|
|
|
dc8c34 |
+# * "Finish" #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+reset_stats_block
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ my $stats = shift;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $stats->{'last'} = shift || 0;
|
|
|
dc8c34 |
+ $stats->{'last_str'} = shift || '';
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ $stats->{'results'}=0;
|
|
|
dc8c34 |
+ $stats->{'srch'}=0;
|
|
|
dc8c34 |
+ $stats->{'add'}=0;
|
|
|
dc8c34 |
+ $stats->{'mod'}=0;
|
|
|
dc8c34 |
+ $stats->{'modrdn'}=0;
|
|
|
dc8c34 |
+ $stats->{'moddn'}=0;
|
|
|
dc8c34 |
+ $stats->{'cmp'}=0;
|
|
|
dc8c34 |
+ $stats->{'del'}=0;
|
|
|
dc8c34 |
+ $stats->{'abandon'}=0;
|
|
|
dc8c34 |
+ $stats->{'conns'}=0;
|
|
|
dc8c34 |
+ $stats->{'sslconns'}=0;
|
|
|
dc8c34 |
+ $stats->{'bind'}=0;
|
|
|
dc8c34 |
+ $stats->{'anonbind'}=0;
|
|
|
dc8c34 |
+ $stats->{'unbind'}=0;
|
|
|
dc8c34 |
+ $stats->{'notesu'}=0;
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+new_stats_block
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ my $name = shift || '';
|
|
|
dc8c34 |
+ my $stats = {
|
|
|
dc8c34 |
+ 'active' => 0,
|
|
|
dc8c34 |
+ };
|
|
|
dc8c34 |
+ if ($name){
|
|
|
dc8c34 |
+ $stats->{'filename'} = $name;
|
|
|
dc8c34 |
+ $stats->{'fh'} = new IO::File;
|
|
|
dc8c34 |
+ $stats->{'active'} = open($stats->{'fh'},">$name");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ reset_stats_block( $stats );
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ return $stats;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+print_stats_block
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ foreach my $stats( @_ ){
|
|
|
dc8c34 |
+ if ($stats->{'active'}){
|
|
|
dc8c34 |
+ if ($stats->{'last'}){
|
|
|
dc8c34 |
+ $stats->{'fh'}->print(
|
|
|
dc8c34 |
+ join(',',
|
|
|
dc8c34 |
+ $stats->{'last_str'},
|
|
|
dc8c34 |
+ $stats->{'last'},
|
|
|
dc8c34 |
+ $stats->{'results'},
|
|
|
dc8c34 |
+ $stats->{'srch'},
|
|
|
dc8c34 |
+ $stats->{'add'},
|
|
|
dc8c34 |
+ $stats->{'mod'},
|
|
|
dc8c34 |
+ $stats->{'modrdn'},
|
|
|
dc8c34 |
+ $stats->{'moddn'},
|
|
|
dc8c34 |
+ $stats->{'cmp'},
|
|
|
dc8c34 |
+ $stats->{'del'},
|
|
|
dc8c34 |
+ $stats->{'abandon'},
|
|
|
dc8c34 |
+ $stats->{'conns'},
|
|
|
dc8c34 |
+ $stats->{'sslconns'},
|
|
|
dc8c34 |
+ $stats->{'bind'},
|
|
|
dc8c34 |
+ $stats->{'anonbind'},
|
|
|
dc8c34 |
+ $stats->{'unbind'},
|
|
|
dc8c34 |
+ $stats->{'notesu'} ),
|
|
|
dc8c34 |
+ "\n" );
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ $stats->{'fh'}->print(
|
|
|
dc8c34 |
+ "Time,time_t,Results,Search,Add,Mod,Modrdn,Delete,Abandon,".
|
|
|
dc8c34 |
+ "Connections,SSL Conns,Bind,Anon Bind,Unbind,Unindexed\n"
|
|
|
dc8c34 |
+ );
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+inc_stats
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ my $n = shift;
|
|
|
dc8c34 |
+ foreach(@_){
|
|
|
dc8c34 |
+ $_->{$n}++
|
|
|
dc8c34 |
+ if exists $_->{$n};
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ return;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+displayBindReport
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ # Loop for each DN - sort alphabetically
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+ # Display all the IP addresses, then counts of all the operations it did
|
|
|
dc8c34 |
+ #
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print "\nBind Report\n";
|
|
|
dc8c34 |
+ print "====================================================================\n\n";
|
|
|
dc8c34 |
+ foreach $bindDN (sort { $bindReport{$a} <=> $bindReport{$b} } keys %bindReport) {
|
|
|
dc8c34 |
+ print("Bind DN: $bindDN\n");
|
|
|
dc8c34 |
+ print("--------------------------------------------------------------------\n");
|
|
|
dc8c34 |
+ print(" Client Addresses:\n\n");
|
|
|
dc8c34 |
+ &printClients($bindReport{$bindDN}{"conn"});
|
|
|
dc8c34 |
+ print("\n Operations Performed:\n\n");
|
|
|
dc8c34 |
+ &printOpStats($bindDN);
|
|
|
dc8c34 |
+ print("\n");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print "Done.\n";
|
|
|
dc8c34 |
+ exit (0);
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+printClients
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ @bindConns = &cleanConns(split(' ', @_[0]));
|
|
|
dc8c34 |
+ $IPcount = "1";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ foreach $ip ( keys %connList ){ # Loop over all the IP addresses
|
|
|
dc8c34 |
+ foreach $bc (@bindConns){ # Loop over each bind conn number and compare it
|
|
|
dc8c34 |
+ if($connList{$ip} =~ / $bc /){
|
|
|
dc8c34 |
+ print(" [$IPcount] $ip\n");
|
|
|
dc8c34 |
+ $IPcount++;
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+cleanConns
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ @dirtyConns = @_;
|
|
|
dc8c34 |
+ $#cleanConns = -1;
|
|
|
dc8c34 |
+ $c = 0;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ for ($i = 0; $i <=$#dirtyConns; $i++){
|
|
|
dc8c34 |
+ if($dirtyConns[$i] ne ""){
|
|
|
dc8c34 |
+ $cleanConns[$c++] = $dirtyConns[$i];
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ return @cleanConns;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+printOpStats
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $dn = @_[0];
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ if( $bindReport{$dn}{"failedBind"} == 0 ){
|
|
|
dc8c34 |
+ print(" Binds: " . $bindReport{$dn}{"binds"} . "\n");
|
|
|
dc8c34 |
+ } else {
|
|
|
dc8c34 |
+ print(" Binds: " . $bindReport{$dn}{"binds"} . " (Invalid Credentials: " . $bindReport{$dn}{"failedBind"} . ")\n");
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ print(" Searches: " . $bindReport{$dn}{"srch"} . "\n");
|
|
|
dc8c34 |
+ print(" Modifies: " . $bindReport{$dn}{"mod"} . "\n");
|
|
|
dc8c34 |
+ print(" Adds: " . $bindReport{$dn}{"add"} . "\n");
|
|
|
dc8c34 |
+ print(" Deletes: " . $bindReport{$dn}{"del"} . "\n");
|
|
|
dc8c34 |
+ print(" Compares: " . $bindReport{$dn}{"cmp"} . "\n");
|
|
|
dc8c34 |
+ print(" ModRDNs: " . $bindReport{$dn}{"modrdn"} . "\n");
|
|
|
dc8c34 |
+ print(" Ext Ops: " . $bindReport{$dn}{"ext"} . "\n\n");
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# Hash File Functions #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+openFailed
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $open_error = @_[0];
|
|
|
dc8c34 |
+ $file_name = @_[1];
|
|
|
dc8c34 |
+ closeDataFiles();
|
|
|
dc8c34 |
+ removeDataFiles();
|
|
|
dc8c34 |
+ die ("Can not open $file_name error ($open_error)");
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+openDataFiles
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ # hash files
|
|
|
dc8c34 |
+ open ($ATTR, ">$ATTR") or do { openFailed($!, $ATTR) };
|
|
|
dc8c34 |
+ open ($RC, ">$RC") or do { openFailed($!, $RC) };
|
|
|
dc8c34 |
+ open ($SRC, ">$SRC") or do { openFailed($!, $SRC) };
|
|
|
dc8c34 |
+ open ($RSRC, ">$RSRC") or do { openFailed($!, $RSRC) };
|
|
|
dc8c34 |
+ open ($EXCOUNT, ">$EXCOUNT") or do { openFailed($!, $EXCOUNT) };
|
|
|
dc8c34 |
+ open ($CONN_HASH, ">$CONN_HASH") or do { openFailed($!, $CONN_HASH) };
|
|
|
dc8c34 |
+ open ($IP_HASH, ">$IP_HASH") or do { openFailed($!, $IP_HASH) };
|
|
|
dc8c34 |
+ open ($CONNCOUNT, ">$CONNCOUNT") or do { openFailed($!, $CONNCOUNT) };
|
|
|
dc8c34 |
+ open ($NENTRIES, ">$NENTRIES") or do { openFailed($!, $NENTRIES) };
|
|
|
dc8c34 |
+ open ($FILTER, ">$FILTER") or do { openFailed($!, $FILTER) };
|
|
|
dc8c34 |
+ open ($BASE, ">$BASE") or do { openFailed($!, $BASE) };
|
|
|
dc8c34 |
+ open ($DS6XBADPWD, ">$DS6XBADPWD") or do { openFailed($!, $DS6XBADPWD) };
|
|
|
dc8c34 |
+ open ($SASLMECH, ">$SASLMECH") or do { openFailed($!, $SASLMECH) };
|
|
|
dc8c34 |
+ open ($BINDLIST, ">$BINDLIST") or do { openFailed($!, $BINDLIST) };
|
|
|
dc8c34 |
+ open ($ETIME, ">$ETIME") or do { openFailed($!, $ETIME) };
|
|
|
dc8c34 |
+ open ($OID, ">$OID") or do { openFailed($!, $OID) };
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # array files
|
|
|
dc8c34 |
+ open($SRCH_CONN,">$SRCH_CONN") or do { openFailed($!, $SRCH_CONN) };
|
|
|
dc8c34 |
+ open($SRCH_OP, ">$SRCH_OP") or do { openFailed($!, $SRCH_OP) };
|
|
|
dc8c34 |
+ open($DEL_CONN, ">$DEL_CONN") or do { openFailed($!, $DEL_CONN) };
|
|
|
dc8c34 |
+ open($DEL_OP, ">$DEL_OP") or do { openFailed($!, $DEL_OP) };
|
|
|
dc8c34 |
+ open($MOD_CONN, ">$MOD_CONN") or do { openFailed($!, $MOD_CONN) };
|
|
|
dc8c34 |
+ open($MOD_OP, ">$MOD_OP") or do { openFailed($!, $MOD_OP) };
|
|
|
dc8c34 |
+ open($ADD_CONN, ">$ADD_CONN") or do { openFailed($!, $ADD_CONN) };
|
|
|
dc8c34 |
+ open($ADD_OP, ">$ADD_OP") or do { openFailed($!, $ADD_OP) };
|
|
|
dc8c34 |
+ open($MODRDN_CONN, ">$MODRDN_CONN") or do { openFailed($!, $MODRDN_CONN) };
|
|
|
dc8c34 |
+ open($MODRDN_OP, ">$MODRDN_OP") or do { openFailed($!, $MODRDN_OP) };
|
|
|
dc8c34 |
+ open($CMP_CONN, ">$CMP_CONN") or do { openFailed($!, $CMP_CONN) };
|
|
|
dc8c34 |
+ open($CMP_OP,">$CMP_OP") or do { openFailed($!, $CMP_OP) };
|
|
|
dc8c34 |
+ open($TARGET_CONN, ">$TARGET_CONN") or do { openFailed($!, $TARGET_CONN) };
|
|
|
dc8c34 |
+ open($TARGET_OP, ">$TARGET_OP") or do { openFailed($!, $TARGET_OP) };
|
|
|
dc8c34 |
+ open($MSGID, ">$MSGID") or do { openFailed($!, $MSGID) };
|
|
|
dc8c34 |
+ open($BIND_CONN, ">$BIND_CONN") or do { openFailed($!, $BIND_CONN) };
|
|
|
dc8c34 |
+ open($BIND_OP, ">$BIND_OP") or do { openFailed($!, $BIND_OP) };
|
|
|
dc8c34 |
+ open($UNBIND_CONN, ">$UNBIND_CONN") or do { openFailed($!, $UNBIND_CONN) };
|
|
|
dc8c34 |
+ open($UNBIND_OP, ">$UNBIND_OP") or do { openFailed($!, $UNBIND_OP) };
|
|
|
dc8c34 |
+ open($EXT_CONN, ">$EXT_CONN") or do { openFailed($!, $EXT_CONN) };
|
|
|
dc8c34 |
+ open($EXT_OP, ">$EXT_OP") or do { openFailed($!, $EXT_OP) };
|
|
|
dc8c34 |
+ open($NOTES_ETIME, ">$NOTES_ETIME") or do { openFailed($!, $NOTES_ETIME) };
|
|
|
dc8c34 |
+ open($NOTES_CONN, ">$NOTES_CONN") or do { openFailed($!, $NOTES_CONN) };
|
|
|
dc8c34 |
+ open($NOTES_OP, ">$NOTES_OP") or do { openFailed($!, $NOTES_OP) };
|
|
|
dc8c34 |
+ open($NOTES_TIME, ">$NOTES_TIME") or do { openFailed($!, $NOTES_TIME) };
|
|
|
dc8c34 |
+ open($NOTES_NENTRIES, ">$NOTES_NENTRIES") or do { openFailed($!, $NOTES_NENTRIES) };
|
|
|
dc8c34 |
+ open($BADPWDCONN, ">$BADPWDCONN") or do { openFailed($!, $BADPWDCONN) };
|
|
|
dc8c34 |
+ open($BADPWDOP, ">$BADPWDOP") or do { openFailed($!, $BADPWDOP) };
|
|
|
dc8c34 |
+ open($BADPWDIP, ">$BADPWDIP") or do { openFailed($!, $NADPWDIP) };
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # info files
|
|
|
dc8c34 |
+ open($BINDINFO, ">$BINDINFO") or do { openFailed($!, $BINDINFO) };
|
|
|
dc8c34 |
+ open($BASEINFO, ">$BASEINFO") or do { openFailed($!, $BASEINFO) };
|
|
|
dc8c34 |
+ open($SCOPEINFO, ">$SCOPEINFO") or do { openFailed($!, $SCOPEINFO) };
|
|
|
dc8c34 |
+ open($FILTERINFO, ">$FILTERINFO") or do { openFailed($!, $FILTERINFO) };
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+closeDataFiles
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ close $ATTR;
|
|
|
dc8c34 |
+ close $RC;
|
|
|
dc8c34 |
+ close $SRC;
|
|
|
dc8c34 |
+ close $RSRC;
|
|
|
dc8c34 |
+ close $EXCOUNT;
|
|
|
dc8c34 |
+ close $CONN_HASH;
|
|
|
dc8c34 |
+ close $IP_HASH;
|
|
|
dc8c34 |
+ close $CONNCOUNT;
|
|
|
dc8c34 |
+ close $NENTRIES;
|
|
|
dc8c34 |
+ close $FILTER;
|
|
|
dc8c34 |
+ close $BASE;
|
|
|
dc8c34 |
+ close $DS6XBADPWD;
|
|
|
dc8c34 |
+ close $SASLMECH;
|
|
|
dc8c34 |
+ close $BINDLIST;
|
|
|
dc8c34 |
+ close $ETIME;
|
|
|
dc8c34 |
+ close $OID;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # array files
|
|
|
dc8c34 |
+ close $SRCH_CONN;
|
|
|
dc8c34 |
+ close $SRCH_OP;
|
|
|
dc8c34 |
+ close $DEL_CONN;
|
|
|
dc8c34 |
+ close $DEL_OP;
|
|
|
dc8c34 |
+ close $MOD_CONN;
|
|
|
dc8c34 |
+ close $MOD_OP;
|
|
|
dc8c34 |
+ close $ADD_CONN;
|
|
|
dc8c34 |
+ close $ADD_OP;
|
|
|
dc8c34 |
+ close $MODRDN_CONN;
|
|
|
dc8c34 |
+ close $MODRDN_OP;
|
|
|
dc8c34 |
+ close $CMP_CONN;
|
|
|
dc8c34 |
+ close $CMP_OP;
|
|
|
dc8c34 |
+ close $TARGET_CONN;
|
|
|
dc8c34 |
+ close $TARGET_OP;
|
|
|
dc8c34 |
+ close $MSGID;
|
|
|
dc8c34 |
+ close $BIND_CONN;
|
|
|
dc8c34 |
+ close $BIND_OP;
|
|
|
dc8c34 |
+ close $UNBIND_CONN;
|
|
|
dc8c34 |
+ close $UNBIND_OP;
|
|
|
dc8c34 |
+ close $EXT_CONN;
|
|
|
dc8c34 |
+ close $EXT_OP;
|
|
|
dc8c34 |
+ close $NOTES_ETIME;
|
|
|
dc8c34 |
+ close $NOTES_CONN;
|
|
|
dc8c34 |
+ close $NOTES_OP;
|
|
|
dc8c34 |
+ close $NOTES_TIME;
|
|
|
dc8c34 |
+ close $NOTES_NENTRIES;
|
|
|
dc8c34 |
+ close $BADPWDCONN;
|
|
|
dc8c34 |
+ close $BADPWDOP;
|
|
|
dc8c34 |
+ close $BADPWDIP;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # info files
|
|
|
dc8c34 |
+ close $BINDINFO;
|
|
|
dc8c34 |
+ close $BASEINFO;
|
|
|
dc8c34 |
+ close $SCOPEINFO;
|
|
|
dc8c34 |
+ close $FILTERINFO;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+removeDataFiles
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ unlink $ATTR;
|
|
|
dc8c34 |
+ unlink $RC;
|
|
|
dc8c34 |
+ unlink $SRC;
|
|
|
dc8c34 |
+ unlink $RSRC;
|
|
|
dc8c34 |
+ unlink $EXCOUNT;
|
|
|
dc8c34 |
+ unlink $CONN_HASH;
|
|
|
dc8c34 |
+ unlink $IP_HASH;
|
|
|
dc8c34 |
+ unlink $CONNCOUNT;
|
|
|
dc8c34 |
+ unlink $NENTRIES;
|
|
|
dc8c34 |
+ unlink $FILTER;
|
|
|
dc8c34 |
+ unlink $BASE;
|
|
|
dc8c34 |
+ unlink $DS6XBADPWD;
|
|
|
dc8c34 |
+ unlink $SASLMECH;
|
|
|
dc8c34 |
+ unlink $BINDLIST;
|
|
|
dc8c34 |
+ unlink $ETIME;
|
|
|
dc8c34 |
+ unlink $OID;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # array files
|
|
|
dc8c34 |
+ unlink $SRCH_CONN;
|
|
|
dc8c34 |
+ unlink $SRCH_OP;
|
|
|
dc8c34 |
+ unlink $DEL_CONN;
|
|
|
dc8c34 |
+ unlink $DEL_OP;
|
|
|
dc8c34 |
+ unlink $MOD_CONN;
|
|
|
dc8c34 |
+ unlink $MOD_OP;
|
|
|
dc8c34 |
+ unlink $ADD_CONN;
|
|
|
dc8c34 |
+ unlink $ADD_OP;
|
|
|
dc8c34 |
+ unlink $MODRDN_CONN;
|
|
|
dc8c34 |
+ unlink $MODRDN_OP;
|
|
|
dc8c34 |
+ unlink $CMP_CONN;
|
|
|
dc8c34 |
+ unlink $CMP_OP;
|
|
|
dc8c34 |
+ unlink $TARGET_CONN;
|
|
|
dc8c34 |
+ unlink $TARGET_OP;
|
|
|
dc8c34 |
+ unlink $MSGID;
|
|
|
dc8c34 |
+ unlink $BIND_CONN;
|
|
|
dc8c34 |
+ unlink $BIND_OP;
|
|
|
dc8c34 |
+ unlink $UNBIND_CONN;
|
|
|
dc8c34 |
+ unlink $UNBIND_OP;
|
|
|
dc8c34 |
+ unlink $EXT_CONN;
|
|
|
dc8c34 |
+ unlink $EXT_OP;
|
|
|
dc8c34 |
+ unlink $NOTES_ETIME;
|
|
|
dc8c34 |
+ unlink $NOTES_CONN;
|
|
|
dc8c34 |
+ unlink $NOTES_OP;
|
|
|
dc8c34 |
+ unlink $NOTES_TIME;
|
|
|
dc8c34 |
+ unlink $NOTES_NENTRIES;
|
|
|
dc8c34 |
+ unlink $BADPWDCONN;
|
|
|
dc8c34 |
+ unlink $BADPWDOP;
|
|
|
dc8c34 |
+ unlink $BADPWDIP;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ # info files
|
|
|
dc8c34 |
+ unlink $BINDINFO;
|
|
|
dc8c34 |
+ unlink $BASEINFO;
|
|
|
dc8c34 |
+ unlink $SCOPEINFO;
|
|
|
dc8c34 |
+ unlink $FILTERINFO;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+getIPfromConn
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $connip = @_[0];
|
|
|
dc8c34 |
+ $retval = "";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ close $CONN_HASH; # we can not read the file is its already open
|
|
|
dc8c34 |
+ open(CONN,"$CONN_HASH") or do { openFailed($!, $CONN_HASH) };
|
|
|
dc8c34 |
+ while (<CONN>){
|
|
|
dc8c34 |
+ if($_ =~ /$connip (.*)/){
|
|
|
dc8c34 |
+ $retval = $1;
|
|
|
dc8c34 |
+ last;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ close CONN;
|
|
|
dc8c34 |
+ #reopen file for writing(append)
|
|
|
dc8c34 |
+ open($CONN_HASH,">>$CONN_HASH") or do { openFailed($!, $CONN_HASH) };
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ return $retval;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+writeFile
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $file = @_[0];
|
|
|
dc8c34 |
+ $text = @_[1] . "\n";
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ print $file $text;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# This hash file stores one value per line
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+getCounterHashFromFile
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $file = @_[0];
|
|
|
dc8c34 |
+ my %hash = ();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ open(FILE,"$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
+ while(<FILE>){
|
|
|
dc8c34 |
+ chomp;
|
|
|
dc8c34 |
+ $hash{$_}++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ close FILE;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ return %hash;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# this hash file stores two values per line (2 dimension hash)
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+getTwoDimHashFromFile
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $file = @_[0];
|
|
|
dc8c34 |
+ my %hash = ();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ open(FILE,"$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
+ while(<FILE>){
|
|
|
dc8c34 |
+ @parts = split (' ', $_);
|
|
|
dc8c34 |
+ chomp(@parts);
|
|
|
dc8c34 |
+ $hash{$parts[0]}{$parts[1]}++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ close FILE;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ return %hash;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# this hash file stores two values per line (1 dimension hash)
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+getHashFromFile
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $file = @_[0];
|
|
|
dc8c34 |
+ my %hash = ();
|
|
|
dc8c34 |
+ @parts = ();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ open(FILE,"$file") or do { openFailed($!, $file ) };
|
|
|
dc8c34 |
+ while(<FILE>){
|
|
|
dc8c34 |
+ @parts = split (' ',$_);
|
|
|
dc8c34 |
+ chomp(@parts);
|
|
|
dc8c34 |
+ $hash{$parts[0]} = $parts[1];
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ close FILE;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ return %hash;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# Return array of values from the file
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+getArrayFromFile
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ my @arry;
|
|
|
dc8c34 |
+ $file = @_[0];
|
|
|
dc8c34 |
+ $array_count = 0;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ open(FILE,"$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
+ while(<FILE>){
|
|
|
dc8c34 |
+ chomp;
|
|
|
dc8c34 |
+ $arry[$array_count] = $_;
|
|
|
dc8c34 |
+ $array_count++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ close FILE;
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ return @arry;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+# build the three array
|
|
|
dc8c34 |
+sub
|
|
|
dc8c34 |
+getInfoArraysFromFile
|
|
|
dc8c34 |
+{
|
|
|
dc8c34 |
+ $file = @_[0];
|
|
|
dc8c34 |
+ $array_count = 0;
|
|
|
dc8c34 |
+ @parts = ();
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+ open(FILE,"<$file") or do { openFailed($!, $file) };
|
|
|
dc8c34 |
+ while(<FILE>){
|
|
|
dc8c34 |
+ @parts = split (' ,, ',$_);
|
|
|
dc8c34 |
+ chomp(@parts);
|
|
|
dc8c34 |
+ if($#parts > 0){
|
|
|
dc8c34 |
+ $fileArray1[$array_count] = $parts[0];
|
|
|
dc8c34 |
+ $fileArray2[$array_count] = $parts[1];
|
|
|
dc8c34 |
+ $fileArray3[$array_count] = $parts[2];
|
|
|
dc8c34 |
+ $array_count++;
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ }
|
|
|
dc8c34 |
+ close FILE;
|
|
|
dc8c34 |
+}
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+# The End #
|
|
|
dc8c34 |
+# #
|
|
|
dc8c34 |
+#######################################
|
|
|
dc8c34 |
+
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|