Sorting Apache Log Files
sheila at spamcop.net
Mon Jun 18 20:55:16 EDT 2001
On Mon, 18 Jun 2001 19:12:55 -0500, Skip Montanaro <skip at pobox.com>
wrote about Re: Sorting Apache Log Files:
: Sheila> I need to search on Apache's date string.:
: Sheila> How about this? Create a list of tuples, where the tuple is::
: Sheila> (datestamp, full_line)
:That will work, as long as you convert the string representation into
:something that will sort chronologically (e.g. mxDateTime).
Good point, although the person asking the question really indicated
that his difficulty was sorting on something that was not at the
beginning of the line.
:I missed the beginning of this thread, so perhaps this was already
:discussed, but I'm a bit unclear why you should need to sort an Apache log
:file by date/time, since it should already be in chronological order.
He had two different log files that he wanted to merge. Why they
wouldn't be in order to begin with, I really don't know. I just went
with the assumptions presented in the original post.
More information about the Python-list