zerolog icon indicating copy to clipboard operation
zerolog copied to clipboard

Provide a CustomLookupHandler

Open hans-fischer opened this issue 4 years ago • 0 comments

Hello together, Recently I used the hlog.RemoteAddrHandler("ip"), that worked well in my dev-environment but it did not work in a Kubernetes cluster env. Now I will switch to hlog.CustomHeaderHandler("ip", "X-Real-IP") then I will work behind the nginx-ingress but will not work in dev. I could include it into the configuration file but find it more convenient if you guys could provide a CustomLookupHandler.

I know this from tollbooth/limiter-framework where you can define multiple header entries and the first that is not empty will be used. For example I configure my api-limiter like this: limiter.SetIPLookups([]string{"X-Real-IP", "X-Forwarded-For", "RemoteAddr"})

Maybe you can tell me your thoughts about that.

Would be interesting to discuss.

Kind regards Hans Fischer

hans-fischer avatar Feb 08 '21 11:02 hans-fischer