Answer the question
In order to leave comments, you need to log in
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.
location /article/ {
try_files $uri @backend;
access_log /var/log/special.log SpecialFormat;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question