alibaba / tengine

A distribution of Nginx with some advanced features
https://tengine.taobao.org
BSD 2-Clause "Simplified" License
12.65k stars 2.52k forks source link

upstream_addr 字段 打印多个端口的问题。 #1921

Open zhouying370481 opened 3 months ago

zhouying370481 commented 3 months ago

Tengine version: Tengine/2.0.2 (nginx/1.4.6) server_name xxxx.com { location /qweixin/ { proxy_pass http://rssp-act_core_rs_com/; include proxy.conf; } upstream rssp-act_core_rs_com { server 172.18.48.23:9097; server 172.18.48.24:9097; } } 当我访问xxxx.com/qweixin 的时候,nginx 访问日志:upstream_addr 连续2个端口, upstream_addr":"172.18.48.23:9097:9097。 完整日志如下: {"@timestamp":"2024-03-12T11:18:53+08:00","server_addr":"172.16.76.220","server_port":"80","http_COOKIE":"-","ssl_protocol":"-","remote_addr":"58.255.172.138","http_x_forwarded_for":"223.104.76.56","remote_user": "-","time_local": "12/Mar/2024:11:18:53 +0800","request": "GET /qweixin/qwx/common/js/jquery/jquery-1.10.1.min.js HTTP/1.1","host": "static3.xxxx.com","uri":"/qweixin/qwx/common/js/jquery/jquery-1.10.1.min.js","status":"502","body_bytes_sent":"668","request_time":"0.002","upstream_response_time":"0.002, 0.000","upstream_addr":"172.18.48.23:9097:9097","http_referer":"http://weixin.xxxx.com/","http_user_agent":"Mozilla/5.0 (Linux; Android 12; JEF-AN00 Build/HUAWEIJEF-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160065 MMWEBSDK/20231202 MMWEBID/5362 MicroMessxxnger/8.0.47.2560(0x28002F3B) WeChat/arm64 Weixin NetType/5G Language/zh_CN ABI/arm64"}.

tengine 日志格式: log_format ngx_json '{"@timestamp":"$time_iso8601",' '"server_addr":"$server_addr",' '"server_port":"$server_port",' '"http_COOKIE":"$http_COOKIE",' '"ssl_protocol":"$ssl_protocol",' '"remote_addr":"$remote_addr",' '"http_x_forwarded_for":"$http_x_forwarded_for",' '"remote_user": "$remote_user",' '"time_local": "$time_local",' '"request": "$request",' '"host": "$host",' '"uri":"$uri",' '"status":"$status",' '"body_bytes_sent":"$body_bytes_sent",' '"request_time":"$request_time",' '"upstream_response_time":"$upstream_response_time",' '"upstream_addr":"$upstream_addr",' '"http_referer":"$http_referer",' '"http_user_agent":"$http_user_agent"}';