On Wed, 14 Aug 2002, Sudarshan Raghavan wrote:

> On Sun, 11 Aug 2002, Mat Harris wrote:
> 
> > Hi, I want to automate my tripwire log reporting through email but
> > having it send me an email every tem minutes even when it hasn't found
> > anything is a bit annoying. What I want ot do is parse through the
> > viplation statistics and of any of them are greater than 0, THEN email
> > it. Here is an attachement of my script as such and a tripwire report
> 
> The violation statistics are the one's under the added, removed and 
> modified columns or just the one at end that says 
> Total violations found:  0

Does this work for you
#!/usr/local/bin/perl -w
use strict;

open (TRIPLOG, "/tmp/tw-rep.txt") or
    die "Cannot /tmp/tw-rep.txt for reading : $!\n";
while (<TRIPLOG>) {
    if ((/^\s+Rule Name/ ... /^\n$/) && /\d/) {
        my ($add, $rem, $mod) = (split)[-3, -2, -1];
        if ($add > 0 || $rem > 0 || $mod > 0) {
            print "Violations found\n";
            # You can do your sendmail part here
        }
    }
}
close (TRIPLOG);


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to