Linux – How to cache browsing history and bandwidth utilization on squid

linuxsquid

I want to know how to monitor the users browsing history and bandwidth utilized by individual IP addresses on Squid proxy. How can i get it done.

Best Answer

squid maintains a thorough access log, typically in /var/log/squid, aptly named access.log.

There is a utility named sarg, the Squid Analysis Report Generator, that can be used to parse this log, gather useful statistics from it, and generate a friendly and convenient Web-browsable report that you can examine with any Web browser.

In its simplest form, you invoke sarg with the name of the log file you wish to examine, like this:

sarg /var/log/squid/access.log 

For bandwidth utilization::

The basic concept is to set up per-host (class 3) delay pools in squid.conf, then set each of them to the maximum amount of bandwidth I want to allow per user per day. Then, set the "fill" rate to be that maximum amount of bandwidth divided by one day's worth of time, so each delay pool will fill completely in one day.