xyz2b opened a new issue #4417:
URL: https://github.com/apache/apisix/issues/4417
### Issue description
request help: http-logger plugin log_format `$host` value is wrong.
The `$host` should be the host requested by the client, but the local
address of apisix obtained in http-logger.
http-logger log_format config
```shell
{
"count": "1",
"node": {
"key": "/apisix/plugin_metadata/http-logger",
"value": {
"log_format": {
"route_id": "$route_id",
"route_name": "$route_name",
"uri": "$uri",
"http_x_forwarded_for": "$http_x_forwarded_for",
"request_method": "$request_method",
"upstream_addr": "$upstream_addr",
"request_time": "$request_time",
"consumer_name": "$consumer_name",
"upstream_response_time": "$upstream_response_time",
"request_body": "$request_body",
"protocol": "$server_protocol",
"bytes_sent": "$bytes_sent",
"http_user_agent": "$http_user_agent",
"status": "$status",
"@source": "$server_addr",
"http_referrer": "$http_referer",
"upstream_status": "$upstream_status",
"@timestamp": "$time_iso8601",
"host": "$host",
"service_id": "$service_id",
"remote_user": "$remote_user",
"body_bytes_sent": "$body_bytes_sent",
"remote_addr": "$remote_addr",
"server": "$server_name",
"upstream_connect_time": "$upstream_connect_time",
"request_uri": "$request_uri",
"content_type": "$content_type",
"port": "$server_port",
"service_name": "$service_name"
}
}
},
"action": "get"
}
```
elk log
```shell
{
"_source": {
"route_name": "aomp-web-websocket",
"request_time": 0.08,
"port": "9080",
"upstream_connect_time": 0,
"@timestamp": "2021-06-11T10:28:49.000Z",
"host": "10.107.97.180",
.....
}
}
```
### Environment
Request help without environment information will be ignored or closed.
* apisix version (cmd: `apisix version`): 2.6
* OS (cmd: `uname -a`):
```shell
[app@VM_97_180_centos apisix]$ uname -a
Linux VM_97_180_centos 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23
15:46:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
```
* OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
```shell
[app@VM_97_180_centos apisix]$ openresty -V
nginx version: openresty/1.19.3.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.1.1k 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/data/app/openresty/nginx --with-debug
--with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -O2'
--add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62
--add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2
--add-module=../set-misc-nginx-module-0.32
--add-module=../form-input-nginx-module-0.12
--add-module=../encrypted-session-nginx-module-0.08
--add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19
--add-module=../ngx_lua_upstream-0.07
--add-module=../headers-more-nginx-module-0.33
--add-module=../array-var-nginx-module-0.05
--add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15
--add-module=../redis-nginx-module-0.3.7 --add-module=../ngx_stream_lua-0.0.9
--with-ld-opt=-Wl,-rpath,/data/app/openresty/luajit/lib --user=app --group=apps
--add-module=/data/backup/openresty-1.19.3.1/../mod_dubbo
--add-module=/data/backup/openresty-1.19.3.1/../ngx_multi_upstream_module --
add-module=/data/backup/openresty-1.19.3.1/../apisix-nginx-module
--with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module
--with-stream_ssl_preread_module --with-http_v2_module
--without-mail_pop3_module --without-mail_imap_module
--without-mail_smtp_module --with-http_stub_status_module
--with-http_realip_module --with-http_addition_module
--with-http_auth_request_module --with-http_secure_link_module
--with-http_random_index_module --with-http_gzip_static_module
--with-http_sub_module --with-http_dav_module --with-http_flv_module
--with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat
--with-openssl=/data/backup/openresty-1.19.3.1/../openssl-OpenSSL_1_1_1k
--with-openssl-opt=-g --with-stream --with-http_ssl_module
```
* etcd version, if have (cmd: run `curl
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
```shell
[app@VM_97_180_centos apisix]$ curl --cert ./ssl/etcd.pem --key
./ssl/etcd-key.pem --cacert ./ssl/ca.pem -i
https://etcd01.apisix.webank.com:2379/version
{"etcdserver":"3.4.16","etcdcluster":"3.4.0"}
```
* apisix-dashboard version, if have: 2.6.1
* luarocks version, if the issue is about installation (cmd: `luarocks
--version`):
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]