#2034 closed enhancement (invalid)
Can't log http2 custom header in Nginx access log
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-module | Version: | 1.19.x |
Keywords: | http2 grpc custom header | Cc: | |
uname -a: | Linux GZ_GZJF_VM000317 2.6.32-573.3.1.el6.x86_64 #1 SMP Thu Aug 13 22:55:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.17.8
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx-1.17.8 --with-http_ssl_module --with-http_v2_module --with-http_auth_request_module --with-debug |
Description
I want to log gRPC HTTP2 custom header grpc-status in access log
tried
log_format main '$remote_addr - $remote_user [$time_local] "$request"
'$status $http_grpc_status $body_bytes_sent'
'"$http_user_agent" "$http_x_forwarded_for"';
But not working, only http status code logged
Change History (3)
follow-ups: 2 3 comment:1 by , 4 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 4 years ago
I used $upstream_trailer_grpc_status,now it's working Thank you Replying to Maxim Dounin:
The $http_... variables you are using are for request headers. In contrast,
grpc-status
is either response header field, or a response trailer field, depending on a particular response. That is, $upstream_http_... or $upstream_trailer_... variables should be used instead.
comment:3 by , 4 years ago
If grpc-status is Non-zero it will be a http2 response header, if it's zero it will be a response trailer header. In order to log all kinds of grpc-status, I had to specify two fields in log_format: $upstream_http_grpc_status and $upstream_trailer_grpc_status
Is there a way to log grpc-status using just one field, like $status
Replying to Maxim Dounin:
The $http_... variables you are using are for request headers. In contrast,
grpc-status
is either response header field, or a response trailer field, depending on a particular response. That is, $upstream_http_... or $upstream_trailer_... variables should be used instead.
The $http_... variables you are using are for request headers. In contrast,
grpc-status
is either response header field, or a response trailer field, depending on a particular response. That is, $upstream_http_... or $upstream_trailer_... variables should be used instead.