>Thanks for the pointers I have made your recommended modifications, as you
>can see I'm new to this, much appreciated. :-)
>
>The script as it stands is very inefficient because of the way I have done
>it, you mentioned saving the matches or IP's in a hash how would I go about
>doing this if you dont mind me asking?
>
>John W. Krahn wrote:
>
>> I don't understand why you are saying that the append option does not 
>> workcorrectly. What exactly are you trying to accomplish?
>>
>Hi John!
>
>Thanks,
>The append option works correctly the first time and then continues
>to append to the file every time I run it.0
>So in effect I'm getting the same log entries appear in the dump file
>($date-$ip.log).
>I will want to run the script every (x) seconds and dump each
>router/firewall log to its own log file for further processing
>, if I could get it to check from the last point in the
> $log_file even better but thats for a later mission.


There is a solution, "Trailing a Growing File", in the Perl Cookbook that I
have used before that may solve your problem.

I ran my script from inittab so it respawned if it died and it checks any
new data written to a log file.  If a certain string is found it did some
processing.  I don't have my script anymore but this is the excert from the
Cookbook:

$naptime = 1;
use IO::Handle;
open (LOGFILE, "/tmp/logfile") or die "can't open /tmp/logfile: $!";
for (;;) {
    while (<LOGFILE>) { check for your IP and do something }
    sleep $naptime;
    LOGFILE->clearerr();            # clear stdio error flag
}




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to