P is for Practical | |
PerlMonks |
Re^3: Parsing a specific section of a log fileby jethro (Monsignor) |
on Mar 05, 2007 at 04:13 UTC ( [id://603166]=note: print w/replies, xml ) | Need Help?? |
No, my solution would make a logical AND every 5 minutes. I'll elaborate:
At 17:20 your program would get called and would read in a small file (lets call it /tmp/last). In that file would be stored Now your program would open the logfile, seek to the file position from 1), read the logfile from there and calculate the two boolean values (is there a success line? is there a non-zero value ?). This would be the result for time slot 17:15 to 17:20 Now the program can calculate the endresult for the half hour by ANDing the values from 2) to 6) and the newly calculated values.
Finally the program overwrites /tmp/last and stores the following into it: After 5 minutes your program gets called and does all of the above again. The temporary file is like a pipeline storing only the last 5 results, shifting out an old one and getting a new one.
In Section
Seekers of Perl Wisdom
|
|