You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/04/16 12:31:34 UTC

[GitHub] [apisix-ingress-controller] xuminwlt commented on issue #962: request help: Ingress custom variables for logging format in access.log

xuminwlt commented on issue #962:
URL: https://github.com/apache/apisix-ingress-controller/issues/962#issuecomment-1100653529

   The APISIX's  access log only support NGINX's variable and the access.log look like this with the config:
   
   ```
    http:
       enable_access_log: true         # enable access log or not, default true
       access_log: logs/access.log
       access_log_format: '{"status": $status,"body_bytes_sent": $upstream_response_length,"scheme":"$scheme","http_user_agent":"$http_user_agent","request_length": $request_length,"request_body":"$request_length","remote_addr":"$remote_addr","request_time": $upstream_response_time,"host":"$host","server_port":"80","clientIp":"$remote_addr","client_addr":"$remote_addr:$remote_port","request_uri":"$request_uri","time":"$time_iso8601","http_referer":"$http_referer","x_forwarded_for":"$http_x_forwarded_for","x_real_ip":"$http_x_real_ip","upstream_addr":"$upstream_addr","method":"$request_method","server_addr":"$server_addr","appName":"-$server_name","backendName":"-@kubernetes","source":"apisixAccess","trace_id":""}'
       access_log_format_escape: json
   
   ```
   access.log
   ```
   {"status": 200,"body_bytes_sent": 710,"scheme":"http","http_user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.84 Safari/537.36","request_length": 569,"request_body":"569","remote_addr":"::1","request_time": 0.003,"host":"localhost","server_port":"80","clientIp":"::1","client_addr":"::1:55367","request_uri":"/headers","time":"2022-04-13T16:42:54+08:00","http_referer":"","x_forwarded_for":"","x_real_ip":"","upstream_addr":"127.0.0.1:1980","method":"GET","server_addr":"::1","appName":"-_","backendName":"-@kubernetes","source":"apisixAccess","uber_trace_id":""}
   
   ```
   
   Unfortunately, I also need several other parameters, refer to the partially custom variables using nginx-controller. These variables are not supported in APISIX. So ask if there is any way to get some of the above variable information.
   
   For example:
   ![image](https://user-images.githubusercontent.com/5835937/163675085-4b6418f8-0940-4319-b99e-d2d736918694.png)
   
   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org