my $window = 300; # 5 min. my @errors; my @timestamps; while (<ACCESSLOG>) { my $timestamp = get_timestamp($_); while (!@timestamps or $timestamps[-1] < $timestamp + $window) { if (defined(my $err = <ERRORLOG>)) { push @errors, $err; push @timestamps, get_timestamp($err); } else { last; } } while (@timestamps and $timestamps[0] < $timestamp - $window) { shift @errors; shift @timestamps; } for my $error (@errors) { # check if access line $_ matchs # with error line $error here: ... } }
In reply to Re: Working with Access Logs
by salva
in thread Working with Access Logs
by perl_devel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |