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/01/06 03:58:12 UTC

[GitHub] [apisix] jagerzhang edited a comment on issue #5868: docs: Can the Docs show a complete example of log_format?

jagerzhang edited a comment on issue #5868:
URL: https://github.com/apache/apisix/issues/5868#issuecomment-1006265184


   > Hi @jagerzhang, here has one PR that describes all Apache APISIX supporting variables, see https://github.com/apache/apisix/pull/5997/files
   > 
   > As for the default `log_format` configuration, we could find them here https://github.com/apache/apisix/blob/master/apisix/plugins/kafka-logger.lua#L90-L95 and https://github.com/apache/apisix/blob/master/apisix/utils/log-util.lua#L33-L40
   > 
   > Could you help to improve the Docs to make it more clear?
   
   谢谢回复,已经看到你们的PR了,辛苦。
   
   其实在不设置log_format元数据的时候,默认的日志格式应该是这样的:https://github.com/apache/apisix/blob/aff5d825aaea12eab312e65e82d060ab9be9b06f/apisix/utils/log-util.lua#L99-L124
   
   所以,我觉得文档中的log_format的例子可以将上述默认日志格式作为展示,比如:
   ```
   {
       "url": "$scheme://$host:$server_port$request_uri",
       "uri": "$request_uri",
       "method": "$request_method",
       "headers": "这里是一个集合,可能不太好获取",
       "querystring": "$query_string",
       "size": "$request_length",
       "response": {
           "status": "$status",
           "headers": "这里是一个集合,可能不太好获取",
           "size": "$bytes_sent"
       },
       "server": {
           "hostname": "$hostname",
           "version": "$nginx_version"
       },
       "upstream": "$upstream_addr",
       "service_id": "$service_id",
       "route_id": "$route_id",
       "consumer": "$consumer",
       "client_ip": "$client_ip",
       "start_time": "$start_time",
       "latency": "$latency"
   }
   ```
   注:可能有些是一个函数,不知道该怎么改成变量,我大概意思是在不设置log_format的时候的APISIX默认日志格式,可以做成一个一个完整例子,用户在定义log_format的时候只需要参考这个趋向于完整的例子去改,这样上手门槛就降低了非常多了,而且日志也是更全面的。


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