Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2002 09:55:42 +0000
From:      "Alex Dyas" <alexdyas@hotmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re - Sorting Apache logs by Date and Time
Message-ID:  <F940tWqhUYLqVpUOF9v0001dd18@hotmail.com>

next in thread | raw e-mail | index | archive | help
sort -k <n> <logfile>

where n is the space delimeted field you want to sort on. thus to solve your 
problem :

sort -k 4 access_log

alex...

>Hi All,
>is there a quick way to sort apache logs by the date and time
>field if the format is the following:
>
>146.101.149.65 - - [22/Feb/2002:04:18:54 +1100] "GET
>/images/test.png HTTP/1.0" 200 381
>"http://www-redirect.scott.sh:8080/cgi-bin/fred.pl" "Mozilla/4.0
>(compatible; MSIE 5.5; Windows 98)"
>
>This is a sample line.
>
>I have found difficulty in using the sort utility because of the
>textual month names, as well as the fact that the separators are
>both slashes and colons.
>
>Regards and TIA,
>Scott Aitken


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F940tWqhUYLqVpUOF9v0001dd18>