From 3446e9d01bdd5e8916eaba5b87241bb33b9316eb Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Thu, 4 Apr 2002 20:28:08 +0000 Subject: [PATCH] Added an exclude_pattern check field. A match on exclude_pattern will exclude the log entry from that check. --- src/lib/Spong/Client/logmon.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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', -- 2.30.2