in reply to How to quickly parse a huge web log file?
But... Do you have to look at every line?
Logfiles are generally already sorted, after all. Assuming that's true of yours, then you can stop as soon as you see the first entry from the 14th (or any date after the 13th). If you want even more of a speed boost, you can use seek to do a binary search in the file for the first entry on the 13th instead of starting at the beginning and schlepping through all the older stuff. And you might even be able to optimize the search a little more by first checking the earliest and latest dates it covers - if it's for 7/12 - 7/19, you'll probably do better to start looking somewhere around 14-15% into the file instead of at the center.
But that's all assuming that the log is already sorted by date. If the entries are unsorted, then you pretty much have to look at every one of them and expect it to take at least 3 minutes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to quickly parse a huge web log file?
by BrowserUk (Patriarch) on Jul 22, 2007 at 05:02 UTC | |
|
Re^2: How to quickly parse a huge web log file?
by jhourcle (Prior) on Jul 22, 2007 at 06:58 UTC | |
|
Re^2: How to quickly parse a huge web log file?
by dbmathis (Scribe) on Jul 23, 2007 at 13:50 UTC | |
by Corion (Patriarch) on Jul 23, 2007 at 13:58 UTC |