http://www.perlmonks.org?node_id=998102


in reply to Re^3: Using binary search to get the last 15 minutes of httpd access log
in thread Using binary search to get the last 15 minutes of httpd access log

Here is the code I ended up using to search the ordered apache logs for a specific time block.
#!/usr/bin/env perl use strict; use Search::Dict; open my $fh, "/var/log/http/access_log"; my $start = 'Oct 2 10:21:'; my $end = 'Oct 2 10:2[1-2]:'; look $fh, $start; while (my $line = <$fh>) { last if ($line !~ /$end/); print $line; }
Also, looks like I should have done a more thorough search
  • Comment on Re^4: Using binary search to get the last 15 minutes of httpd access log
  • Download Code