Passing variables to access_log, error_log names

António P. P. Almeida appa at
Sun Feb 27 19:56:07 MSK 2011

On 27 Fev 2011 08h17 WET, igor at wrote:

>> I just tried:
>> set $test foo;
>> access_log /var/log/nginx/$test.domain_access.log;
>> error_log  /var/log/nginx/domain_error.log;
>> And no access log entry is registered whatsoever. I'm using 0.9.4.
>> Can you elaborate on your 'Variables in access_log should work'?
>> Do you mean it should work in a dirname and not on a filename?
>> E.g.:
>> access_log /var/log/nginx/$test/domain_access.log;
> nginx workers must have rights to create files in /var/log/nginx.

They have. If I set: 

access_log /var/log/nginx/foo.domain_access.log;
error_log  /var/log/nginx/domain_error.log;

a new access log file is created. It just happens that with the above
setting of $set foo no foo.domain_access.log file is created.

--- appa

More information about the nginx mailing list