Opened 9 years ago

Closed 9 years ago

#939 closed defect (invalid)

acess_log with if unnecessarily accesses access_log causing error

Reported by: simonhf@… Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.8.x
Keywords: access_log if Cc:
uname -a: Linux ubuntu 4.2.0-25-generic #30-Ubuntu SMP Mon Jan 18 12:31:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.8.1.8

Description

Consider this conf line:

access_log /var/log/nginx/access.log combined if=0;

Works correctly when nginx run with sudo. But if not then we get the following error:

nginx: [emerg] open() "/var/log/nginx/access.log" failed (13: Permission denied)

The thing is, because the if condition is zero then surely it should not even be trying to access /var/log/nginx/access.log, or?

Change History (1)

comment:1 by Maxim Dounin, 9 years ago

Resolution: invalid
Status: newclosed

The if= conditions are evaluated at runtime and don't affect opening of log files - they only specify if a particular request will be logged to the log in question. Regardless of the conditions specified the file will be opened. If you don't want nginx to open the file - comment out the access_log directive.

Note: See TracTickets for help on using tickets.