Disable logging in nginx for specific request

后端 未结 2 774
予麋鹿
予麋鹿 2020-12-31 05:43

I\'m trying to \"ignore\" or redirect certain request in the nginx log based on the request URI.

So far I have this:

server {
  listen      80;
  #.         


        
2条回答
  •  渐次进展
    2020-12-31 06:29

    You can do this with conditional logging. It would look something like

    map $request $loggable {
        ~*lbcheck\.html 0;
        default 1;
    }
    access_log  /path/logs/name.log if=$loggable;
    

提交回复
热议问题