httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Turner <kk...@swbell.net>
Subject Re: "sort" command question
Date Fri, 19 Jul 2002 02:26:48 GMT
On Thu, 18 Jul 2002 15:04:13 -0700 (PDT), Apolinaras Sinkevicius wrote:

>I need to sort my log file cronologically what do I
>need to enter in command line for SORT on RedHat to
>get the log file sorted?
>
>Here is a snipet of log file. NOTE: this is custom
>style, not the regular apache log file.
>
>
>dialup-dialup-63.214.107.155.Dial1.Boston1.Level3.net.dial1.boston1.level3.net
>[03/Mar/2002:09:40:39 -0600] "GET
>/cleavers/windowsmedia_white.gif HTTP/1.1" 200 1861
>"http://www.carmelformusic.com/cleavers/themusic.html"
>"Mozilla/4.0 (compatible; MSIE 5.01; Windows 95;
>SPINWAY.COM)"

As a general approach, run as root 

#!/bin/bash
# 7/18/02
# Gary Turner
# test script to move date group to the front of the line
# in an Apache access.log file.

# Second, it sorts by the date group and then saves to a temp file

# Make path and file names right.

cat /var/log/apache/access.log | sed -e 's/\([^\[]*\)\(\[.*\]
\)\(.*$\)/\2\1\3/g' | sort > /tmp/datesort.temp

The above is all one line.
I'm a doofus with regexp's, so someone's bound to have a better
solution.

But out of curiosity, aren't your logs already in chronological order?
--
gt       kk5st@swbell.net
It ain't so much what you don't know that gets you in trouble---
it's what you do know that ain't so.--unk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message