I have kong’s helm chart setup, i have induced custom json log format as env variable
- name: KONG_NGINX_HTTP_LOG_FORMAT
value: apm escape=json ‘{“time_local”:“$time_local”,“request”:“$request”,“request_length”:$request_length,“status”:$status,“bytes_sent”:$bytes_sent,“body_bytes_sent”:$body_bytes_sent,“http_referer”:“$http_referer”,“http_user_agent”:“$http_user_agent”,“upstream_addr”:“$upstream_addr”,“upstream_status”:$upstream_status,“request_time”:$request_time,“upstream_response_time”:$upstream_response_time,“upstream_connect_time”:$upstream_connect_time,“upstream_header_time”:$upstream_header_time,“x_forwarded_for”:“$http_x_forwarded_for”,“remote_addr”:“$remote_addr”,“request_path”:“$request_uri”}’
but cases like upstream_response_time, upstream_header_time result in empty if request is terminated at kong layer. I get improper json format as these field are integer not string, cannot send proper json logs to kibana.
any idea if we can set those header values by default = 0 or -1 incase values are absent, should overwrite when values are present