diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2017-08-08 13:32:24 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2017-08-08 13:32:24 +0300 |
commit | 48a53386ca210f3eb0d6b6921e16d2eb8fd8a59b (patch) | |
tree | ae72e4e3575595f7d168e5ac80d3e827bd0f31e7 /utils/rspamd_stats.pl | |
parent | 1d2fd784bbccff24f628a6531dfd2375f9073d89 (diff) | |
download | rspamd-48a53386ca210f3eb0d6b6921e16d2eb8fd8a59b.tar.gz rspamd-48a53386ca210f3eb0d6b6921e16d2eb8fd8a59b.zip |
[Minor] rspamd_stats: allow to omit date in time specification
Diffstat (limited to 'utils/rspamd_stats.pl')
-rwxr-xr-x | utils/rspamd_stats.pl | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl index 008121d10..af5b4ec6f 100755 --- a/utils/rspamd_stats.pl +++ b/utils/rspamd_stats.pl @@ -74,6 +74,8 @@ my %scanTime = ( ); my %bidir_match; +foreach ( $startTime, $endTime ) { $_ = &normalized_time($_) } + # Convert bidirectional symbols foreach my $s (@symbols_bidirectional) { $bidir_match{$s} = { @@ -427,6 +429,16 @@ sub log_time_format { return $format; } +sub normalized_time { + return undef + if !defined( $_ = shift ); + + /^\d\d(?::\d\d){0,2}$/ + ? sprintf '%04d-%02d-%02d %s', 1900 + (localtime)[5], 1 + (localtime)[4], + (localtime)[3], $_ + : $_; +} + sub numeric { $a =~ /\.(\d+)\./; my $a_num = $1; @@ -527,13 +539,15 @@ Exclude log lines if certain symbols are fired (e.g. GTUBE). You may specify thi Select log entries after this time. Format: C<YYYY-MM-DD HH:MM:SS> (can be truncated to any desired accuracy). If used with B<--end> select entries between -B<--start> and B<--end>. +B<--start> and B<--end>. The omitted date defaults to the current date if you +supply the time. =item B<--end> Select log entries before this time. Format: C<YYYY-MM-DD HH:MM:SS> (can be truncated to any desired accuracy). If used with B<--start> select entries between -B<--start> and B<--end>. +B<--start> and B<--end>. The omitted date defaults to the current date if you +supply the time. =item B<--help> |