2
1
0

Hi, 

We run a couple of nmis installs, all 5.8.6 or earlier and plan to upgrade shortly. I have noticed that in the log display window, the logs don't display in the correct order, ie I have a syslog file called infrastructure.log that contains all our network equipment. 

The log files we have are:

infrastructure.log

infrastructure1.log

infrastructure2.log

etc

infrastructure10.log

 

In the log display windows, the order of display is

infrastructure.log

infrastructure1.log

infrastructure10.log

infrastructure2.log

 

Can this be fixed easily?

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      on further review i've realised where the bug is in logs.pl; it sorts correctly and numerically by sortOrder in the dropdown list but asciibetically in the Log List. here's the trivial patch to fix this behaviour:

      diff --git a/cgi-bin/logs.pl b/cgi-bin/logs.pl
      index 013fe5b..6dee83e 100755
      --- a/cgi-bin/logs.pl
      +++ b/cgi-bin/logs.pl
      @@ -286,7 +286,7 @@ sub viewLogList {
                                                      th({class=>'header',style=>'text-align:center'},'Last Update')
                                              );
              
      -               foreach my $i (sort  keys %{$LL} )  {
      +               foreach my $i (sort { ($LL->{$a}->{logOrder}||$a) <=> ($LL->{$b}->{logOrder}||$b) } keys %{$LL} )  {
                              if ( $LL->{$i}{logFileName} ne '' and -r $LL->{$i}{logFileName} ) {
                                              @filestat = stat $LL->{$i}{logFileName};
                                              $logFileSize = $filestat[7] . ' bytes';
      
      
        CommentAdd your comment...