sandy420 opened a new issue #5512:
URL: https://github.com/apache/apisix/issues/5512


   ### Issue description
   
          I found that the values obtained by $request_time, 
upstream_response_time, and upstream_header_time in the logs collected by 
kafka-logger are wrong, and the values of the nginx variables output in the 
access.log under the logs directory of apisix are correct.
         In theory, a request should be $request_time greater than 
upstream_response_time; $upstream_response_time greater than 
upstream_header_time, but the results of the ELK query in the ELK collected by 
the kafka-logger plugin do not match the actual.
   
![lQLPDhraI8bUmAbNAXrNA7CwCkfx2evB-GwBkqSZGEAkAA_944_378](https://user-images.githubusercontent.com/10955441/141731080-68e7782f-3c53-43e3-ab55-462e3ecdee93.png)
   
   
![image](https://user-images.githubusercontent.com/10955441/141730616-8211a8b3-e23d-4dcd-8155-1b3d8d01ef71.png)
   
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):apisix2.10.1
   - OS (cmd: `uname -a`):centos 7.3
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):1.19
   - etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):3.4
   - apisix-dashboard version, if have:no
   - the plugin runner version, if the issue is about a plugin runner (cmd: 
depended on the kind of runner):no
   - luarocks version, if the issue is about installation (cmd: `luarocks 
--version`):3.4
   
   
   ### Steps to reproduce
   
   The kafka-logger plugin log_format configuration:
   
   {
   "log_format": {
   "server_name": "$server_name",
   "upstream_cache_status": "$upstream_cache_status",
   "request_method": "$request_method",
   "upstream_http_content_disposition": "$upstream_http_content_disposition",
   "request_time": "$request_time",
   "http_user_agent": "$http_user_agent",
   "upstream_response_time": "$upstream_response_time",
   "upstream_header_time": "$upstream_header_time",
   "upstream_connect_time": "$upstream_connect_time",
   "request_length": "$request_length",
   "http_app_jb": "$http_app_jb",
   "server_protocol": "$server_protocol",
   "upstream_scheme": "$upstream_scheme",
   "upstream_bytes_received": "$upstream_bytes_received",
   "realip_remote_addr": "$realip_remote_addr",
   "remote_addr": "$remote_addr",
   "http_referer": "$http_referer",
   "upstream_http_content_type": "$upstream_http_content_type",
   "uri": "$uri",
   "request_completion": "$request_completion",
   "body_bytes_sent": "$body_bytes_sent",
   "msec": "$msec",
   "http_x_forwarded_for": "$http_x_forwarded_for",
   "http_client_info": "$http_client_info",
   "bytes_sent": "$bytes_sent",
   "@timestamp": "$time_iso8601",
   "content_type": "$content_type",
   "server_port": "$server_port",
   "upstream_uri": "$upstream_uri",
   "upstream_status": "$upstream_status",
   "route_name": "$route_name",
   "url": "$url",
   "host": "$host",
   "status": "$status",
   "upstream_addr": "$upstream_addr",
   "consumer_name": "$consumer_name",
   "upstream_host": "$upstream_host",
   "http_x_cat_parent_id": "$http_x_cat_parent_id",
   "upstream_http_content_length": "$upstream_http_content_length",
   "content_length": "$content_length",
   "scheme": "$scheme",
   "remote_user": "$remote_user",
   "route_id": "$route_id",
   "request_uri": "$request_uri"
   }
   }
   
   ### Actual result
   
   
![image](https://user-images.githubusercontent.com/10955441/141729417-10eacdfc-7770-4d8d-ac98-a453e22f75eb.png)
   
   
   ### Error log
   
   no
   
   ### Expected result
   
   The kafka-logger plugin can correctly collect the value of each nginx 
built-in variable


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to