Re: [squid-users] Might be useful to someone - realtime log view

From: bimal pandit <bimalp@dont-contact.us>
Date: 25 Aug 2004 12:44:01 +0530

Dear James,

certainly a GOOD job!!

while i used it in redhat linux 9 for analysis first i got this error

awk: cmd. line:2: printf("%8.2f Kb\t%-16s %s\t%s - %s\n" \
awk: cmd. line:2: ^ invalid char '?' in expression

then i modified a bit as ...

[cut & paste]

clear;tail -f /var/log/squid/access.log | awk '{ printf("%8.2f Kb\t%-16s
%s\t%s - %s\n" ,$5/1024,$8,$7,$10,substr($4,5,(match(4,/\//)-5)))
}'

[cut & paste]

now what i got is

(size kb) (user) (url) (data type)
    | | | |
    V V V V
8.23 Kb bimal http://www.siliconvalleyccie.com/linux-adv/squid.htm
text/html -

0.99 Kb bimal http://www.siliconvalleyccie.com/images/logo.gif
image/gif -

0.47 Kb bimal http://www.siliconvalleyccie.com/favicon.ico
text/plain -

certainly a good script to check the things ONLINE!!

-bimal

On Wed, 2004-08-25 at 06:29, James Gray wrote:
> Greetings all,
>
> I wrote a simple "one-liner" that follows the access.log and formats the
> output in a useful way (for me anyway). It's designed for FreeBSD and
> requires awk/gawk/mawk etc.
>
> Here's the "script" (all on one line, or put it into a file) :)
>
> <<< START >>>
>
> clear ; tail -F /var/log/squid/access.log | \
> awk '{ \
> printf("%8.2f Kb\t%-16s %s\t%s - %s\n" \
> ,$5/1024,$8,$7,$10,substr($4,5,(match(4,/\//)-5))) \
> }'
>
> <<< END >>>
>
> replace "tail -F" with "tail --follow=name" for Linux.
>
> The output is real-time and looks like this:
> (size kb) (user) (url) (data type) (TCP response)
> | | | | |
> V V V V V
> 1.96 Kb USR1 http://foo.example.com text/html - DENIED
> 10.78 Kb USR2 http://bar.example.com text/html - MISS
> 0.56 Kb USR3 http://baz.foo.com/index.htm text/html - MISS
> 8.47 Kb USR1 http://foo.example.com text/html - MISS
> 112.97 Kb USR3 http://baz.foo.com/123.jpeg image/jpeg - HIT
> ...etc
>
> It's useful for me to keep a passing eye on what's going on, but would
> scroll way too fast on really busy squid servers. YMMV.
>
> Cheers,
>
> James Gray
> ______________________________
> I.T. Manager - Asia Region
> Open Channel Solutions
> Sydney NSW 2000, Australia
Received on Wed Aug 25 2004 - 01:10:38 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Sep 01 2004 - 12:00:02 MDT