Sorting out of sequence log Apache log file

Chris W. Parker cparker at swatgear.com
Wed Apr 26 20:11:49 UTC 2006


Ray Van Dolson <mailto:rayvd at digitalpath.net>
    on Wednesday, April 26, 2006 12:43 PM said:

> I assume by out of sequence you mean the time stamps are all off?

Yes.

> The following quickie Python hack works for me.  Basically call it as
> follows: 
> 
>  % cat access_log | /path/to/sort_apache.py > sorted_log.log

Thanks Ray. I had some issues with the indentation originally (never
used Python before) but I've got that sorted out now.

> If it's a huge logfile the script may give you some problems.
> Basically it reads in all the lines in the file and sorts by the date
> and time and then spits it out in the right order.

Thanks for the heads up.




Chris.




More information about the redhat-list mailing list