Two Suggestions

Andrew Sachen's Avatar

Andrew Sachen

18 May, 2017 09:13 PM

So I have two entirely unrelated suggestions

One would be to add descriptions to the HTTP Response Code tooltip text (title values). I know most everyone who uses this program will be familiar with the most common ones, but there are a few obscure codes and confusingly similar 30# values.

The other is to include support for archived logs and a little more control over the date/time range of the log data being viewed. My log system stores the past few months using a set of access logs as gZipped files, the last ten days in independent files, then the weeks prior to that in one file per week. There's still only one log per gz, of course, because they aren't Tarballed, so they've just been appended to each other for storage. It'd be really nice if I could get PML to recognize these files and display them as well. I could probably write a script to join them all into one big file myself, but PML still wouldn't be able to show much of that history with its current "now-and-earlier" setup.

  1. 1 Posted by Andrew Sachen on 22 Dec, 2017 05:53 PM

    Andrew Sachen's Avatar

    I just added GZ support to my own copy, figured I'd include the changes I made.

    File: inc\classes\LogParser.php, of course
    Functions: getNewLines, getLinesFromBottom
    Replace

    $fl = fopen( $file_path , "r" );
    
    at the beginning of each function with
      if ( strtolower( substr( $file_path , -3 ) ) === '.gz' )
      {
       //need a better temp file variable in the future
       $temp_path = '/PATH_TO_TEMP_HERE/tmp/' . basename( $file_path , '.gz' );
       $temp_buffer = 4096;
       $fg = gzopen ( $file_path , "rb" );
       $fu = fopen ( $temp_path , "wb" );
       while( ! gzeof( $fg ) )
       {
        fwrite( $fu , gzread( $fg , $temp_buffer ) );
       }
       fclose( $fu );
       gzclose( $fg );
       $fl = fopen( $temp_path , "r" );
      }
      else
      {
       $fl = fopen( $file_path , "r" );
      }
    
    and then add
      if ( isset( $temp_path ) )
      {
       @unlink( $temp_path );
      }
    
    after
      fclose( $fl );
    
    at the end of the functions. GZ file support complete. Of course, other compression methods can be handled in the new "if" statement.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac