我在负载均衡器中使用的nginx流中具有以下日志记录设置:
stream {
log_format combined '$remote_addr - - [$time_local] $protocol $status $bytes_sent $bytes_received $session_time "$upstream_addr"';
...
}
那行得通,我在日志中得到输出。现在,我想添加一些有关请求网址的信息。
我尝试将$ host $ request_uri和$ scheme添加到log_format定义中,但是在测试配置时出现错误:
$ sudo nginx -t
nginx: [emerg] unknown "scheme" variable
nginx: configuration file /etc/nginx/nginx.conf test failed
$ sudo nginx -t
nginx: [emerg] unknown "host" variable
nginx: configuration file /etc/nginx/nginx.conf test failed
$ sudo nginx -t
nginx: [emerg] unknown "request_uri" variable
nginx: configuration file /etc/nginx/nginx.conf test failed
据我所知,我正在运行最新的nginx版本:
$ sudo nginx -v
nginx version: nginx/1.14.0
如何让nginx记录其他请求信息?