Time for action – enabling user agent logging
By default, the user agent log is disabled and we can enable it by using the following line in our configuration file:
useragent_log /opt/squid/var/logs/useragent.log
Once we have the user agent log enabled, Squid will start logging the User-Agent
HTTP header field from the requests, depending on the availability of the field. Let's see a few lines from an example user agent log:
127.0.0.1 [12/Sep/2010:01:55:33 +0530] "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 GTB7.1" 127.0.0.1 [12/Sep/2010:01:55:33 +0530] "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 GTB7.1 GoogleToolbarFF 7.1.20100830 GTBA"
The format of this file is quite simple and only the last column, representing the user agent, is of interest here. The user agent log can be used to analyze the popular web browsers on a network.
What just happened?
We learned to enable logging of the User-Agent
HTTP header field from...