Feature request to "access_log" directive

Fabiano Furtado Pessoa Coelho fusca14 at gmail.com
Mon Apr 4 19:28:54 UTC 2022


Hi...

Sorry to bother you with this feature request. I believe you software
engineers already thought about it and there are a million reasons to
not implement it.

Well, I'm exactly in this situation described here
https://serverfault.com/questions/498799/how-to-log-nginx-requests-made-to-a-specific-location-in-a-different-file
I want to use "try_files" and log the access within the location with
"try_files" directive...

    location /my_system {
      access_log /var/log/nginx/my_system_access.log;
      try_files $uri @named_loc;
    }
    location @named_loc {
        access_log off;
        proxy_pass http://...;
    }

... and I can't! "Requests are logged in the context of a location
where processing ends. It may be different from the original location,
if an internal redirect happens during request processing."
I can make it work using the "#include" directive and removing the
named location, but using "try_files" is more clean and sophisticated.

Is there a way to include the "now" directive to "access_log"?
Something like: "access_log /var/log/nginx/my_system_access.log now;"

Thanks in advance.
Fabiano



More information about the nginx mailing list