ldap/admin/src/logconv.pl | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
New commits:
commit 257006f1fecc44ad73451c0c720cecdc427f2416
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri Jan 29 10:34:22 2016 -0500
Ticket 48446 - logconv.pl displays negative operation speeds
Bug Description: The script assumed that a full path to logs was provided.
If it was not then the log "access" was not moved to the
end of the list. This throws off many stats.
Fix Description: Properly sort the files, and move "access" to the end
of the list.
https://fedorahosted.org/389/ticket/48446
Reviewed by: nhosoi(Thanks!)
diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl
index 9cd9aaa..22d1a88 100755
--- a/ldap/admin/src/logconv.pl
+++ b/ldap/admin/src/logconv.pl
@@ -388,7 +388,11 @@ sub statusreport {
# #
##########################################
-if ($files[$#files] =~ m/access.rotationinfo/) { $file_count--; }
+if ($files[$#files] =~ m/access.rotationinfo/) {
+ # Remove the rotationinfo file from the log array
+ delete $files[$#files];
+ $file_count--;
+}
$logCount = $file_count;
print "Processing $logCount Access Log(s)...\n";
@@ -398,10 +402,16 @@ print "Processing $logCount Access Log(s)...\n";
#print "--------------------------------------------------\n";
my $skipFirstFile = 0;
-if ($logCount > 1 && $files[0] =~ /\/access$/){
- $files[$logCount] = $files[0];
- $skipFirstFile = 1;
- $file_count++;
+if ($logCount > 1){
+ # sort the log array
+ my @sorted_files = sort @files;
+ if($sorted_files[0] =~ /access$/){
+ # Move "access" to the end of the array
+ $sorted_files[$logCount] = $sorted_files[0];
+ $skipFirstFile = 1;
+ $file_count++;
+ }
+ @files = @sorted_files;
}