Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by mhearse (Hermit)
on Aug 03, 2012 at 21:57 UTC ( #985358=note: print w/ replies, xml ) Need Help??


in reply to Re^2: 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

That is a valid point which I considered too. But this script will run on a loghost. And if I remember correctly... the timestamp will be applied to the messages as they arrive to the loghost.


Comment on Re^3: Using binary search to get the last 15 minutes of httpd access log
Re^4: Using binary search to get the last 15 minutes of httpd access log
by mhearse (Hermit) on Oct 09, 2012 at 23:14 UTC
    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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985358]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2015-07-04 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (58 votes), past polls