I have up to two log files. I only know the partial name but I know that each file has been written to in the past 12 hours. I was thinking about use file::find:
sub wanted {
if ( (stat $File::Find::name)[9] < time() - (3600 * 12) ) {
open LF, ($File::Find::name) || die "cannot open $!";
while (<LF>){
I want to parse the opened files for any entries that look like this:
2005-11-04/08:02:14.011 METRIC 00020036-0800093A log :Monitor: CALLER
+Status *PASS*
2005-11-04/08:11:30.924 METRIC 00020036-08000940 log :Monitor: CALLER
+Status *PASS*
2005-11-04/08:12:29.830 METRIC 00020036-08000941 log :Monitor: CALLER
+Status *PASS*
2005-11-04/09:12:28.790 METRIC 00020036-08000943 log :Monitor: CALLER
+Status *PASS*
2005-11-04/09:12:35.869 METRIC 00020036-08000944 log :Monitor: CALLER
+Status *PASS*
However, I only want to collect PASS entries if they have occured within the past 12 hours. I think this may involve a look ahead type regex but I can't wrap by thoughts around it. Can anyone offer suggestions?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.