[Exim] Re: eximstats and gzipped logfiles

Etusivu
Poista viesti
Vastaa
Lähettäjä: Steve Campbell
Päiväys:  
Vastaanottaja: exim-users
Aihe: [Exim] Re: eximstats and gzipped logfiles
Hugh,
    Which version of eximstats are you using ? Later versions use the
following code to handle gzipped files:


if (@ARGV) {
  # Scan the input files and collect the data
  foreach my $file (@ARGV) {
    if ($file =~ /\.gz/) {
      unless (open(FILE,"gunzip -c $file |")) {
    print STDERR "Failed to gunzip -c $file: $!";
    next;
      }
    }
    elsif ($file =~ /\.Z/) {
      unless (open(FILE,"uncompress -c $file |")) {
    print STDERR "Failed to uncompress -c $file: $!";
    next;
      }
    }
    else {
      unless (open(FILE,$file)) {
    print STDERR "Failed to read $file: $!";
    next;
      }
    }
    #Now parse the filehandle, updating the global variables.
    parse($parser,\*FILE);
  }
}


Version 1.16 should do what you want and is available in the exim-4.05
distribution (it is downwardly compatible).

The latest version (1.18) is available from
http://www.cyberenet.net/~sten/eximstats
MD5: 66961bdb49aed47d671f889b5d0ae3ac
and has a few minor updates, as well as Joachim Wieland's graphical
chart plotting capability. You will need to modify the
'#!/usr/local/bin/perl' line at the top to point to where perl is
installed on your system.

Steve



> Eximstats doesn't cope wth gzipped log files on the command line,
> despite them being fairly standard as a result of exicyclog. A
> search of the archives revealed that it can summarize the files on
> STDIN so one can use gzip -dc to process them. Gzip -d (or gunzip)
> won't pass non-gzipped files straight through, it gives an error if
> the files are not in gzip or compressed format.
> <Lines Snipped>
> Hugh