# Command line options
my $zcat = 'zcat';
-my $bzcat = 'bzcat';
+my $bzcat = 'bunzip2 -c';
my $ucat = 'unzip -p';
my $uncompress_size = "gunzip -l %f | grep -E '^\\s*[0-9]+' | awk '{print \$2}'";
my $format = '';
$uncompress = $bzcat;
} elsif (($logfile =~ /\.zip/i) && ($zcat =~ /^zcat$/)) {
$uncompress = $ucat;
- }
+ }
+ &logmsg('DEBUG', "Compressed file found, will used command: $uncompress $logfile");
open($io, "$uncompress $logfile |") or die "FATAL: cannot open pipe to $uncompress $logfile. $!\n";
# Real size of the file is unknow, try to find it
my $cmd_file_size = $uncompress_size;
} elsif (($logfile =~ /\.zip/i) && ($zcat =~ /^zcat$/)) {
$uncompress = $ucat;
}
+ &logmsg('DEBUG', "Compressed log file, will used command: $uncompress $logfile");
# Open a pipe to zcat program for compressed log
$lfile->open("$uncompress $logfile |") || die "FATAL: cannot read from pipe to $uncompress $logfile. $!\n";
my $time_pattern = qr/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/;
+ &logmsg('DEBUG', "Starting reading file...");
my $cur_pid = '';
while (my $line = <$lfile>) {
$cursize += length($line);
$uncompress = $ucat;
}
+ &logmsg('DEBUG', "Detect compressed file, will used command: $uncompress $file");
# Open a pipe to zcat program for compressed log
$tfile->open("$uncompress $file |") || die "FATAL: cannot read from pipe to $uncompress $file. $!\n";
}
$uncompress = $ucat;
}
+ &logmsg('DEBUG', "Found compressed file, will used command: $uncompress $file");
# Open a pipe to zcat program for compressed log
$tfile->open("$uncompress $file |") || die "FATAL: cannot read from pipe to $uncompress $file. $!\n";
}