Opened 11 years ago

Closed 11 years ago

#404 closed defect (invalid)

while loging errors, nginx does not interpolate ${host}

Reported by: Renich Bon Ciric Owned by:
Priority: major Milestone:
Component: nginx-module Version:
Keywords: Cc:
uname -a: Linux introdesk.g02.org 3.10.9-200.fc19.x86_64 #1 SMP Wed Aug 21 19:27:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.4.2
built by gcc 4.8.1 20130603 (Red Hat 4.8.1-1) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

Description

Description

If you use:

# /etc/nginx/include.d/log_debug.conf
access_log /var/log/nginx/${host}-access.log;
error_log /var/log/nginx/${host}-error.log debug;

Your access log will interpolate ${host}; while not interpolating it on the error log.

You end up with a file called: ${host}-error.log

Version

nginx-1.4.1-1.fc19.x86_64

How reproducible

Set up some configuration and add this line inside server {} for the error log to use the host variable:

access_log /var/log/nginx/${host}-access.log;
error_log /var/log/nginx/${host}-error.log debug;

Try making it err (generate errors).

Actual results

You will end with a proper access file; called, for example: example.tld-access.log and the ${host}-error.log file.

Expected results

You should see example.tld-access.log and example.tld-error.log

Additional info

This bug has been reported on the Fedora Bugzilla already but they decided it was not a bug. Perhaps this is an enhancement request?

Change History (2)

comment:2 by Maxim Dounin, 11 years ago

Resolution: invalid
Status: newclosed

The error_log directive doesn't support variables, and it's highly unlikely it will - as error log is something needed to log errors, and errors may happen, in particular, while interpolating variables.

Note: See TracTickets for help on using tickets.