[Ilugc] Proxy

  • From: stylesen@xxxxxxxxx (Senthil Kumaran S)
  • Date: Thu Aug 24 10:50:28 2006

On 8/24/06, kannan manoharan <scuffy_tomy@xxxxxxxxxxx> wrote:

 If i ran "python geturl.py /var/log/squid/access.log | less" it says :

 Complete blank page and in end of the page "lines ?-?/? (END)"


Yeah I understand your problem. This needs some more insight about
your squid.conf. Just open your squid.conf file and see whether there
is a line called

"emulate_httpd_log on"

If the above is present then your log format will be "common log file
format" in squid terms which will look like this

remotehost rfc931 authuser [date] "method URL" status bytes

For the above format my script works.

If you have not enabled emulate_httpd_log then your log file format is
called "native log file format" which is the default for squid.conf
and it looks like this

For squid 1.0:
time elapsed remotehost code/status/peerstatus bytes method URL

For squid 1.1:
time elapsed remotehost code/status bytes method URL rfc931
peerstatus/peerhost type

And for squid 2.0 there is a small difference in the content.

So when it is this case my script fails. Another easy way to achive
the same thing which my script does is by use of a command :

$ tail -f /var/log/squid/access.log | awk '{print $7}'

The above command is generic enough and works fine for both common and
native file formats. So I would prefer if you use the above command
then you will get what you expect.. Just kick it off and let me know..
Still if you are unable to get the output am ready to help you.

PS: Since I used common log file format based access.log so my python
script failed to perform for native log file format.

-- 
--sen--
Be a man of Deeds
Don't be a man of Needs...
http://stylesen.blogspot.com
http://geocities.com/sen_kavithai

Other related posts: