I have a general question regarding showing pod name into nginx-ingress access logs.
In my current access log setup, I have see only upstream IP address. However sometimes it`s not so informative since there may be situations when some pod was running couple minutes so upstream ip is not help to understand which pod responded with 5xx response.
log-format-upstream: '{"msec": "$msec", "connection": "$connection", "connection_requests": "$connection_requests", "pid": "$pid", "request_id": "$request_id", "request_length": "$request_length", "remote_addr": "$remote_addr", "remote_user": "$remote_user", "remote_port": "$remote_port", "time_local": "$time_local", "time_iso8601": "$time_iso8601", "request": "$request", "request_uri": "$request_uri", "args": "$args", "status": "$status", "body_bytes_sent": "$body_bytes_sent", "bytes_sent": "$bytes_sent", "http_referer": "$http_referer", "http_user_agent": "$http_user_agent", "http_x_forwarded_for": "$http_x_forwarded_for", "http_host": "$http_host", "server_name": "$server_name", "request_time": "$request_time", "upstream": "$upstream_addr", "upstream_connect_time": "$upstream_connect_time", "upstream_header_time": "$upstream_header_time", "upstream_response_time": "$upstream_response_time", "upstream_response_length": "$upstream_response_length", "upstream_cache_status": "$upstream_cache_status", "ssl_protocol": "$ssl_protocol", "ssl_cipher": "$ssl_cipher", "scheme": "$scheme", "request_method": "$request_method", "server_protocol": "$server_protocol", "pipe": "$pipe", "gzip_ratio": "$gzip_ratio", "http_cf_ray": "$http_cf_ray", "http_cf_ipcountry": "$http_cf_ipcountry"}'
So maybe there is a way to show pod name into nginx-ingress logs or maybe you can suggest the way of how to parse upstream_ip to show pod name in logs?
I heard about way to run kubectl get pod | grep <pod-ip>
but it seems not so useful since there may be hundred of access log entries and for each we will send API call with kubectl
1