[squid-users] logformat for requests using PROXY protocol

Amos Jeffries squid3 at treenet.co.nz
Fri Nov 22 09:00:54 UTC 2019


On 22/11/19 4:05 pm, Chammi Kumarapathirage wrote:
> I have my logformat as follows.
> logformat jsonformat {"Client Hostname":"%>A","Source IP":"%>a","HTTP
> Method":"%rm","HTTP Protocol version":"%rv","Request
> Domain":"%>rd","Port":"%>rP","User Agent":"%{User-Agent}>h","Request
> Size":"%>st","Reply Size":"%<st","Response Time(ms)":"%tr","Status
> Code":"%>Hs","Request Status":"%Ss","Server FQDN":"%<A"} 
> 
> The proxy is sitting behind a load balancer in AWS and Proxy Protocol V2
> is enabled on both the LB and Squid. Everything seems to work fine. I
> can create rules based on source IP of the client. However. I want to be
> able to  create rules based on the hostname of the original client. But
> it doesn't seem that Squid sees the original client's hostname. Rather
> it takes the hostname of the LB as seen by below log.

The %>A log code is still tied to old logging state instead of the IP
values updated by PROXY protocol.

The only way I can see to log that value without patching Squid is with
something complicated like an external_acl_type helper to do the lookup
and supply it as a tag or note to Squid.

If you are happy to patch I can make a PR for you to try.


Amos


More information about the squid-users mailing list