[Webinar] Streamline your web hosting managementRegister Today


Changing Log Format on Squid to show Hostname rather than IP Address

Posted on 2008-02-03
Medium Priority
Last Modified: 2013-12-16
Currently have Ubuntu 6.06 Server with Squid 2 and SARG to view reports. Wanting to get the logs to log what we want and not the default logging in Squid, by default SARG shows the IP address of the remote/client machine because squid logs that and we want it to show Machine Name instead due to networking being Dynamic IP's.

Have seen the LogFormat option but have been unable to get squid to restart after adding that line.

Would like to log
"Date / Time / Remote Hostname / Site Visited / Download Size / Time Spent at site / If it is a Denied Site etc..."
I believe it is the same as the default except Remote Hostname instead of IP Address
Question by:thorpey83
LVL 40

Accepted Solution

omarfarid earned 1000 total points
ID: 20812268
Please see the topic below in the links:

Field Definitions -> remotehost

LVL 35

Expert Comment

by:Duncan Roe
ID: 20812735
The problem with loggers and host names is that to convert an IP address to a host name requires reverse DNS lookup. This may be either
-slow, resulting in other log messages being lost, or
- unsuccessful anyway.

You could cruft up a post-processor to do the conversion: you'd probably want to keep a cache of resolved IP's and resolving a new one is achieved by dig, e.g

19:35:46$ dig -x|grep|grep -v DiG|awk '{print substr($1,1,length($1)-1)}'

Author Comment

ID: 20820846
omarfarid thanks but that is the site i saw the whole logformat thing but getting squid to actually recognise/restart after entering  the LogFormat="%>A" is another thing.

duncan_roe thanks for the advice but 1 went over my head also was hoping the squid would do it itself if i can change the format of the logs

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension . This reminded me of questions that come up here at EE along the lines of, "How can I tell the type of file from its cont…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

608 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question