Opened 13 years ago

Closed 13 years ago

#67 closed defect (invalid)

access_log with variables in filename does not work

Reported by: Andrey Lyarskiy Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.0.x
Keywords: access_log Cc:
uname -a: 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx: nginx version: nginx/1.0.10
nginx: built by gcc 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/etc/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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g'

Description

Original config:
log_format combined_time '$remote_addr - $remote_user - $proxy_host $upstream_addr [$time_local] '

'"$request" $status $body_bytes_sent $request_time';

server {
...
access_log /var/log/nginx/$host.access.log combined_time;
...
}

Nginx does not creating new log files, and does not write logs access logs at all.

Changing to:
access_log /var/log/nginx/testing.access.log combined_time;

Log file successfully created.

Changing to:
set $site test1;
access_log /var/log/nginx/$site.access.log combined_time;

And again no files created and no access logs at all.

# getenforce
Permissive

Nginx installed from RPM (http://nginx.org/packages/rhel/6/).
OS - Scientific Linux 6.1 x86_64

Change History (1)

comment:1 by Maxim Dounin, 13 years ago

Resolution: invalid
Status: newclosed

Make sure document root is set and exists. See http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log for details.

Note: See TracTickets for help on using tickets.