in reply to
Re: 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
Very minor quibble, and not about Perl. But Apache creates the the timestamp from when the request is received yet writes to the file when the request is served. So, if you've got requests that take a long time to return, or lots of requests that take a very short time, you logs won't be ordered by time.
So, if it's 12:00, and A is a long-running request that started at 11:44 and B is a short-running request, the order of events could be
and the log will read
in that order, so your backward search would stop at A.
If "last 15 minutes" means "approximately last 15 minutes" and your server is relatively zippy, you're fine. I have sometimes needed 15 minutes to mean "exactly 15 minutes", though, so I happen to know this trivial about Apache.