Custom access_log per location /

Hello,

Just wondering if there is support for custom access logs per directory
for a virtual host.

Eg:

location /api/ {
access_log /var/log/nginx/api-access-log;
}

Nginx seems to create the log file, but never adds to it.

Cheers!
-J

Posted at Nginx Forum:

houseofmore Wrote:

}

Yes. access_log directive can be in http, server, or location.

See http://wiki.nginx.org/NginxHttpLogModule.

Nginx seems to create the log file, but never adds
to it.

Perhaps a permission issue? Do the worker processes have write
permission to the file?

Cheers!
-J

Posted at Nginx Forum:

I have the same problem.


log_format  access 

‘$remote_addr\t-\t$remote_user\t[$time_local]\t"$request"\t’
‘$status\t$body_bytes_sent\t"$http_referer"\t’
‘“$http_user_agent”\t$http_x_forwarded_for’;

access_log  /d1/logs/access.log  access;

#limit_conn crawler 20;

location ~ .*\.(php|php5)?$
{

#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
    expires      30d;
}

location ~ .*\.(js|css)?$
{
    expires      1h;
}

location /noresult_dispatch/ {
    access_log  /d1/logs/noresult_dispatch-access.log  access;
}

"/d1/logs/noresult_dispatch-access.log " filesize is 0.

Posted at Nginx Forum: