S
S
Salavat Sitdikov2014-07-18 10:31:00
Nginx
Salavat Sitdikov, 2014-07-18 10:31:00

How to set the right access_log for a specific location in nginx?

In my previous question , I found a solution to the counter problem for the site and chose let with parsing access_log'a.
To minimize and simplify the work, I decided to make the necessary access_log format for my location /article/ID
However, there was a small problem

The logs are written in the context of the location where processing ends. This may be a different location than the original one if an internal redirect occurs while the request is being processed.

I thought it would be enough
location /article/ {
 try_files $uri @backend;
 access_log /var/log/special.log SpecialFormat;
}

And turned out to be wrong. What other decisions can be made?
Thank you all for your help.
UPD. I found an option when I write the @backend config in the location I need.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question