如何在Nginx访问日志中记录grpc状态?

如何在Nginx访问日志中记录grpc状态?,nginx,grpc,http2,Nginx,Grpc,Http2,我想在Nginx访问日志中记录grpc状态代码 尝试 但是不工作的Nginx只会记录http状态代码而不是grpc_状态*你是什么意思?GRPCS状态? 你已经试过了 创建文件日志: nano/var/log/nginx/[filelog].log [关闭并保存] 在.conf中试试这个 输出服务器指令 日志格式prog3'$remote\u addr-$remote\u user[$time\u local]“$request”” “$status$body\u bytes\u

我想在Nginx访问日志中记录grpc状态代码 尝试

但是不工作的Nginx只会记录http状态代码而不是grpc_状态

*你是什么意思?GRPCS状态? 你已经试过了
  • 创建文件日志:

    • nano/var/log/nginx/[filelog].log
  • [关闭并保存]

  • 在.conf中试试这个

输出服务器指令 日志格式prog3'$remote\u addr-$remote\u user[$time\u local]“$request””
“$status$body\u bytes\u sent”$http\u referer””
“$http_user_agent”$server_port$scheme”

in-server指令 服务器{
.... 访问\u log/var/log/nginx/[filelog].log prog3

  • 并在调试模式下执行nginx
    • 停止nginx
    • /etc/init.d/nginx停止
  • 运行nginx调试
    • /etc/init.d/nginx-debug启动
log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $http_grpc_status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';