nginx - 系统日志未以所需格式记录
nginx - syslog not logging with desired format
这是我的 nginx 配置,日志部分:
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $pipe';
access_log syslog:server=127.0.0.1:514,facility=local0,tag=nginx;
error_log syslog:server=127.0.0.1:514,facility=local1,tag=nginx;
但是当我查看系统日志文件时,我没有看到我添加的 '$request_time $upstream_response_time $pipe'
部分。它只记录默认格式。
有什么问题吗?我可以检查的地方?系统日志本身可能存在一些问题(日志长度等)?
编辑
我尝试将邮件大小增加到 64k,问题仍然存在。
您应该指定要使用自定义格式而不是默认格式进行登录:
access_log syslog:server=127.0.0.1:514,facility=local0,tag=nginx timed_combined buffer=8k;
这是我的 nginx 配置,日志部分:
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $upstream_response_time $pipe';
access_log syslog:server=127.0.0.1:514,facility=local0,tag=nginx;
error_log syslog:server=127.0.0.1:514,facility=local1,tag=nginx;
但是当我查看系统日志文件时,我没有看到我添加的 '$request_time $upstream_response_time $pipe'
部分。它只记录默认格式。
有什么问题吗?我可以检查的地方?系统日志本身可能存在一些问题(日志长度等)?
编辑 我尝试将邮件大小增加到 64k,问题仍然存在。
您应该指定要使用自定义格式而不是默认格式进行登录:
access_log syslog:server=127.0.0.1:514,facility=local0,tag=nginx timed_combined buffer=8k;