Conditional access log formatting ?

B.R. reallfqq-nginx at yahoo.fr
Sat Jul 18 18:02:17 UTC 2015


I suggest you use the 'if' parameter of 2 access_log directive (>v1.7.0),
combined with 2 maps with reversed logic.
---
*B. R.*

On Sat, Jul 18, 2015 at 12:37 PM, Ben <ben+nginx at list-subs.com> wrote:

> Hi,
>
> I'm using haproxy infront of some NGINX instances, but only for some
> instances which are being loadbalanced by haproxy, there are other
> instances which go straight through.
>
> I realise I need to change the logging format in NGINX to enable
> X-Forwarded-For in the access logs.
>
> The question is whether I can conditionally format the logs, i.e. use
> "X-Forwarded-For" if it exists, otherwise use the normal NGINX logging
> format.
>
> I've had a quick peek at the manual, I'm thinking maybe this can be done
> with a map of some sort ?  Maybe there's a better way ?  To be honest I've
> no idea where to start, and I've never used maps before anyway !
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150718/1f5ab075/attachment.html>


More information about the nginx mailing list