<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I suggest you use the 'if' parameter of 2 access_log directive (>v1.7.0), combined with 2 maps with reversed logic.<br></div><div class="gmail_extra"><div><div class="gmail_signature"><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div></div>
<br><div class="gmail_quote">On Sat, Jul 18, 2015 at 12:37 PM, Ben <span dir="ltr"><<a href="mailto:ben+nginx@list-subs.com" target="_blank">ben+nginx@list-subs.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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.<br>
<br>
I realise I need to change the logging format in NGINX to enable X-Forwarded-For in the access logs.<br>
<br>
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.<br>
<br>
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 !<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div></div>