From 257006f1fecc44ad73451c0c720cecdc427f2416 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Jan 29 2016 16:55:42 +0000 Subject: 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; }