
如何在 NGINX 存取日誌中隱藏 POST 請求:
30/Aug/2018:11:03:31 .... method=POST request="POST /api/auth....
答案1
您需要將以下內容新增到您的nginx
配置中,按照文件
map $request_method $loggable {
default 1;
POST 0;
}
access_log /path/to/access.log combined if=$loggable;
此if
參數啟用條件日誌記錄。如果條件評估為“0”或空字串,則不會記錄請求。如果是,則指令map
設定$loggable
為 0$request_method
POST