Sorting out of sequence log Apache log file

Allen K. Smith lazlor at bigboy.lotaris.org
Wed Apr 26 21:05:40 UTC 2006


On Wednesday 26 April 2006 13:26, Chris W. Parker wrote:
> Allen K. Smith <mailto:lazlor at bigboy.lotaris.org>
>     on Wednesday, April 26, 2006 1:20 PM said:
> 
> > 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.. 
> 
> Sure.
> 
> a.b.c.d - - [14/Feb/2006:00:07:03 -0800] "GET /lib/css/forms.css
> HTTP/1.1" 200 1606 "http://www.domain.com/" "Mozilla/4.0 (compatible;
> MSIE 6.0; Windows
>  NT 5.1; SV1; .NET CLR 1.1.4322)"
> a.b.c.d - - [14/Feb/2006:00:07:05 -0800] "GET /lib/css/content.css
> HTTP/1.1" 200 3828 "http://www.domain.com/" "Mozilla/4.0 (compatible;
> MSIE 6.0; Windo
> ws NT 5.1; SV1; .NET CLR 1.1.4322)"
> 
> 
> 
> Thanks,
> Chris.
> 
sort -s -t[ -k 2.4,2.6M -k 2.1,2.2n -k 2.13,2.19n may do it.

I have to RTFM whenever I need to get this working.

http://www.gnu.org/software/textutils/manual/textutils/html_mono/textutils.html#SEC23

Good luck :-)

-Allen




More information about the redhat-list mailing list