--- /usr/local/bin/pflogsumm Sun Dec 30 15:00:19 2007 +++ /usr/local/bin/pflogsumm2 Wed Jan 2 01:33:45 2008 @@ -363,7 +365,7 @@ my $hasDateCalc = $@ ? 0 : 1; my $mailqCmd = "mailq"; -my $release = "1.1.1"; +my $release = "1.1.1mod"; # Variables and constants used throughout pflogsumm use vars qw( @@ -1289,11 +1291,23 @@ sub really_print_hash_by_cnt_vals { my($hashRef, $cnt, $indents) = @_; + # changed, ms + # recount total number of events + my $total = 0; + $total += $_ foreach (values(%$hashRef)); + # minimum number of occurances + # absolute and relative to $total + my $abs_limit = 2; + my $rel_limit = $total / 100; + foreach (map { $_->[0] } sort { $b->[1] <=> $a->[1] || $a->[2] cmp $b->[2] } map { [ $_, $hashRef->{$_}, normalize_host($_) ] } (keys(%$hashRef))) { + # changed, ms + # do not show events with only few occurances + next if ($hashRef->{$_} < $abs_limit || $hashRef->{$_} < $rel_limit); printf "$indents%6d%s %s\n", adj_int_units($hashRef->{$_}), $_; last if --$cnt == 0; }