I am trying to make nginx's access log conditional using an if
statement but its not working.
This is the relevant code from the configuration file.
map $uri $log_access {
/.lb-check 0;
default 1;
}
server {
...
access_log /var/log/nginx/access.log combined if=$log_access;
...
}
I don't want certain requests to be logged, in this instance its a request made by the load balancer to the url /.lb-check
Unfortunately this configuration isn't working
I have also tried doing the following and that doesn't work either.
location = /.lb-check { access_log off; }
Does anyone know why these methods aren't working?