id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,uname,nginx_version 717,Conditional logging does not work as expected - negated conditions log to more than one file,Mercedes Coyle,,"I am trying to setup conditional logging so that POST requests with a debug header are routed to a separate logfile. If the debug header is not set, or it is set to false, then $debug value will be 0. If it is set to true, $debug value will be 1. The request should be logged to one of two files depending on the value of $debug, using a conditional (if=$debug and if=!$debug). map $http_debug $debug { default 0; “false"" 0; ""true"" 1; } location = /events { if ($request_method = POST) { echo_read_request_body; access_log /path/to/logfile/access_post.log post_events_format if=!$debug; access_log /path/to/logfile/access_post_header.log events_header_format if=$debug; break; } I would expect the above conditional to log a $debug=0 request to access_post.log, and a $debug=1 request to access_post_header.log. In actuality, the $debug=0 requests are logged to access_post.log, and $debug=1 requests are logged to both access_post_header.log and access_post.log.",defect,closed,minor,,nginx-core,1.7.x,invalid,conditional logging,,Linux [host] 3.2.0-31-virtual #50-Ubuntu SMP Fri Sep 7 16:36:36 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux,"nginx version: nginx/1.7.9 built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --user=www-data --group=nginx --with-debug --with-file-aio --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx-1.7.9/body --http-fastcgi-temp-path=/var/lib/nginx-1.7.9/fastcgi --http-proxy-temp-path=/var/lib/nginx-1.7.9/proxy --http-scgi-temp-path=/var/lib/nginx-1.7.9/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx-1.7.9/uwsgi --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_spdy_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/usr/local/src/nginx-1.7.9/modules/nginx-dav-ext --add-module=/usr/local/src/nginx-1.7.9/modules/nginx-echo-0.57 --add-module=/usr/local/src/nginx-1.7.9/modules/nginx-geoip-0.2 --add-module=/usr/local/src/nginx-1.7.9/modules/nginx-http-auth-pam-1.3 --add-module=/usr/local/src/nginx-1.7.9/modules/nginx-upstream-fair --with-cc-opt='-Wno-error -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed'"