nginx: [emerg] 未知的日志格式
·
问题:nginx: [emerg] 未知的日志格式
我试图排除 pingdom 出现在我的 nginx 访问日志中,但是出现错误:
nginx: [emerg] unknown log format "if=$excluded_ua" in /etc/nginx/nginx.conf:55
nginx: configuration file /etc/nginx/nginx.conf test failed
在我添加的配置中:
http {
...
map $http_user_agent $excluded_ua {
pingdom 0;
~Preload 0;
default 1;
}
access_log /var/log/nginx/access.log combined if=$excluded_ua;
...
}
纠正错误后,我仍然在我的访问文件中看到 Pingdom 条目。
94.247.174.83 - - [26/Oct/2017:22:02:56 +0100] "GET / HTTP/1.1" 200 14832 "-" "Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)"
解答
您可能需要包含一个 log_format。默认是“组合”。可以试试access_log /var/log/nginx/access.log combined if=$excluded_ua;吗?
http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
更多推荐

所有评论(0)