in reply to Working with Access Logs
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: ... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Working with Access Logs
by superfrink (Curate) on Feb 28, 2006 at 12:15 UTC |