aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-13 16:15:01 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-13 16:15:01 +0000
commitdad6f34f2855ac223f50d5b1db4899088b953a34 (patch)
tree9387395186a25bd6dfe78599126fd56eaae19897 /utils
parent0496a98fe0b580937c378485ed00f80f8d988adf (diff)
downloadrspamd-dad6f34f2855ac223f50d5b1db4899088b953a34.tar.gz
rspamd-dad6f34f2855ac223f50d5b1db4899088b953a34.zip
[Fix] Fix processing of a single compressed file
Diffstat (limited to 'utils')
-rwxr-xr-xutils/rspamd_stats.pl15
1 files changed, 11 insertions, 4 deletions
diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl
index 822985ed9..ae7ce2115 100755
--- a/utils/rspamd_stats.pl
+++ b/utils/rspamd_stats.pl
@@ -112,9 +112,11 @@ elsif ( -d "$log_file" ) {
open( $rspamd_log, "-|", "$dc $log_dir/$_" )
or die "cannot execute $dc $log_dir/$_ : $!";
- printf "\033[J Parsing log files: [%d/%d] %s\033[G", $log_file_num++, scalar @logs, $_;
- $spinner_update_time = 0; # Force spinner update
- &spinner;
+ if (!$json) {
+ printf "\033[J Parsing log files: [%d/%d] %s\033[G", $log_file_num++, scalar @logs, $_;
+ $spinner_update_time = 0; # Force spinner update
+ &spinner;
+ }
&ProcessLog;
@@ -123,7 +125,12 @@ elsif ( -d "$log_file" ) {
}
}
else {
- open($rspamd_log, '<', $log_file) or die "cannot open $log_file";
+ my $ext = ($log_file =~ /[^.]+\.?([^.]*?)$/)[0];
+ my $dc = $decompressor{$ext} || 'cat';
+ open( $rspamd_log, "-|", "$dc $log_file" )
+ or die "cannot execute $dc $log_file : $!";
+ $spinner_update_time = 0; # Force spinner update
+ &spinner;
&ProcessLog();
}