Feature request to "access_log" directive

Francis Daly francis at daoine.org
Tue Apr 12 11:19:28 UTC 2022

On Mon, Apr 11, 2022 at 10:02:40AM -0300, Fabiano Furtado Pessoa Coelho wrote:

Hi there,

> I've one more question about an access_log weird behavior, when it's
> configured with a $1 regex return variable.

http://nginx.org/r/access_log -- The file path can contain variables

> For instance:
> location ~ ^/(system1|system2) {
>   access_log /var/log/nginx/$1_access.log;
>   proxy_pass ...;
> }
> The only way NGINX can write to system1_access.log and
> system2_access.log files is when they exist in the specified
> directory. Otherwise, the log isn't computed.

My guess is that

the user whose credentials are used by worker processes should have
permissions to create files in a directory with such logs;

is not the case.

$ ls -ld /var/log/nginx/
$ ls -l /var/log/nginx/system1_access.log

might show the users and permissions involved.

Good luck with it,

Francis Daly        francis at daoine.org

More information about the nginx mailing list