Sorting out of sequence log Apache log file

Allen K. Smith lazlor at bigboy.lotaris.org
Wed Apr 26 20:19:41 UTC 2006


On Wednesday 26 April 2006 13:13, Chris W. Parker wrote:
> Allen K. Smith <mailto:lazlor at bigboy.lotaris.org>
>     on Wednesday, April 26, 2006 1:04 PM said:
> 
> > sort -t[ -k 2.4,6M -k 2.1,2n access_log
> 
> Maybe I'm not using it correctly but that made the file even worse.
> 
> # sort -t[ -k 2.4,6M -k 2.1,2n Feb-14.log > Feb-14_sorted2.log
> 
Can you copy a couple of lines in? I was just using a generic apache log as an example, so the field positions may be wrong..

sort -t[ -k 2.4,6M -k 2.1,2n -k 2.13,19n 

would catch the timestamps as well (d'oh).

With a handful of example lines should be able to make it exact, it there enough data in the source file to give you what you need.

> After about a minute I got back a file with the log entries mixed up
> even more. Did I do something wrong?
> 
> 
> 
> Thanks,
> Chris.
> 




More information about the redhat-list mailing list