From: Stephen L Johnson Date: Thu, 4 Apr 2002 20:28:08 +0000 (+0000) Subject: Added an exclude_pattern check field. A match on exclude_pattern will exclude X-Git-Tag: spong-2_7_7~14 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3446e9d01bdd5e8916eaba5b87241bb33b9316eb;p=spong.git Added an exclude_pattern check field. A match on exclude_pattern will exclude the log entry from that check. --- diff --git a/src/lib/Spong/Client/logmon.pm b/src/lib/Spong/Client/logmon.pm index e5ed118..6f8db46 100755 --- a/src/lib/Spong/Client/logmon.pm +++ b/src/lib/Spong/Client/logmon.pm @@ -15,6 +15,9 @@ # 05/19/99 - Stephen L Johnson # Fixed a couple of bugs in the &new_file() which cause # routine to not open the new file. +# 12/21/01 - Stephen L Johnson +# Added an exclude_pattern check field. A match on exclude_pattern +# will exclude the log entry from that check. package Spong::Client::logmon; @@ -125,8 +128,14 @@ sub check { $fh->seek($self->{'pos'},0); while (<$fh>) { foreach $rep (@{$self->{'checks'}}) { - $pattern = $rep->{'pattern'}; - if (/$pattern/i) { + my $pattern = $rep->{'pattern'}; + my $exc_pattern = $rep->{'exclude_pattern'}; + # If we get a hit and (no exclude or exclude doesn't hit) + if ( (! $exc_pattern || + $exc_pattern && ! m/$exc_pattern/ ) && + m/$pattern/i + ) { + m/$pattern/i; $text = eval '"' . $rep->{'text'} . '"'; $id = $text if ! $rep->{'id'}; $self->{'stati'}->{$id} = { item=>'logs',