]> git.etc.gen.nz Git - spong.git/commitdiff
Added an exclude_pattern check field. A match on exclude_pattern will exclude
authorStephen L Johnson <sjohnson@monsters.org>
Thu, 4 Apr 2002 20:28:08 +0000 (20:28 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Thu, 4 Apr 2002 20:28:08 +0000 (20:28 +0000)
the log entry from that check.

src/lib/Spong/Client/logmon.pm

index e5ed11855b6bcb40f19472be86db6dea9fbfe5d7..6f8db4613191e16d62c0156cd2996c68561072c2 100755 (executable)
@@ -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',