Re: [squid-users] Squid reverse proxy AND proxy

From: Michael Alger <squid@dont-contact.us>
Date: Fri, 4 May 2007 09:59:13 -0400

On Fri, May 04, 2007 at 10:02:28AM +0200, Jerome wrote:

> How to log access by reverse proxy ? And in which file ?
> access.log ?

You can log it into whatever file you want. I'm using squid as a
reverse proxy for two sites, which I want to log separately. You can
do this by defining access lists which match the kind of traffic you
want to log for each site, then apply them to an access log.

acl consumer_site dstdomain .consumer.com
acl corporate_site dstdomain .corporate.com

access_log /var/log/web/consumer.log combined consumer_site
access_log /var/log/web/corporate.log combined corporate_site

Where "combined" is the log format to use. I defined this myself,
which you might want to do in order to capture the information you
want. The ACL name on the end restricts logging to only requests
which match the given ACL.

Here's my log format; you can find the various tags in the stock
squid.conf comments:

logformat combined %>a %ui %un [%tg] "%rm %ru HTTP/%rv" %Hs %<st
                   "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh %mt

This should all be on a single line without the excess whitespace,
and must be defined before you reference it in the access_log lines.
Again, "combined" is just a tag you assign to it.

For your forward proxying, you can just use the standard:

access_log /var/log/squid/access.log squid

This will log all requests in squid's normal log format. You might
want to define an ACL which excludes your hosted sites, and apply it
to this log file. If you leave it as-is, access to your hosted
sites will be logged both to the access.log and to the site-specific
log.
Received on Fri May 04 2007 - 07:59:17 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:04 MDT