Nginx,排除访问日志的特定 URL

Nginx,排除访问日志的特定 URL

在我的 nginx Web 服务器的访问日志中,有如下日志:

XX.XX.147.5 - - [20/Oct/2022:18:42:59 +0000] "GET /my-subfolder/readiness HTTP/1.1" 200 1496 "-" "EF-Strati-HealthCheck-Client/1.0" "11.16.133.0"
XX.XX.94.5 - - [20/Oct/2022:18:42:59 +0000] "POST /my-subfolder/some-path-to-exclude/socket.io/?EIO=4&transport=polling&t=OFsjAj9&sid=2Mufsq23xBh8FRLWAFtD HTTP/1.1" 200 2 "https://www.myapp-example.com/my-subfolder/home" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" "161.165.148.42, 23.205.100.169, 10.74.133.61,11.16.53.0"

我如何制定规则来排除已进入的日志/socket.io/

有没有办法放一些正则表达式?比如:

location ~ ^/socket.io/(.*)$ {
  access_log off;
}

答案1

在此处输入图片描述

您尝试过 localstroge.debug="*" 吗?网站:在此处输入链接描述

相关内容