Squid separate access.log by http_port [closed]

I’ve AP 2 interface they’re ip 192.168.200.1, 192.168.201.1 HTTP access from each interface i’m redirect it to difference squid port

192.168.200.0/24 ==> 192.168.200.1:3129
192.168.201.0/24 ==> 192.168.200.1:3130

with these line in iptables.conf

-A PREROUTING -i wlan0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.200.1:3129
-A PREROUTING -i wlan1 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.201.1:3130

and in squid3.conf

http_port 192.168.200.1:3129 intercept name=ap1
http_port 192.168.201.1:3130 intercept name=ap2

access_log daemon:/var/log/squid3/ap1/access.log squid
access_log daemon:/var/log/squid3/ap2/access.log squid

But now it’s write both file with same data how to separate access data to each access.log file.

Answer

AFAIK Squid does not support internal splitting of events to different access_log files, unlike Apache where you can log per virtual host.

If the current acces_log does not contain the information you need you can change that with the logformat directive.

And if the reason you wanted the different log files is to generate statistics it is trivial to run a pre-processing script to filter the existing log by client ip-address

Attribution
Source : Link , Question Author : Bear0x3f , Answer Author : HBruijn

Leave a Comment