Time for action – using access_log to control logging of requests
As we have seen in a previous section of this chapter, the syntax of the access_log
directive is as follows:
access_log <module>:<path> [<logformat name> [acl acl ...]]
So, here we have an option to specify ACL lists which we can use to control where the different requests will be logged, if at all. Let's consider a scenario where we don't want to log requests to Yahoo! servers and we do want to log requests to Google and Facebook servers to separate files, and all other requests go to the access log. This scenario can be realized with the following configuration:
acl yahoo dstdomain .yahoo.com acl google dstdomain .google.com acl facebook dstdomain .facebook.com log_access deny yahoo log_access allow all access_log /opt/squid/var/logs/google.log squid google access_log /opt/squid/var/logs/facebook.log squid facebook access_log /opt/squid/var/logs/access.log
If we look at the configuration carefully, we are denying...