Hi Zuochen, Glad to see that you're using the Apache Way to seek help from Apache APISIX Community :)
Because of the limitations of the mailing list, we couldn't see your images (I mean the screenshot of the log in your mail). Could you please paste your logs in text here? Best Regards! @ Zhiyuan Ju <https://github.com/juzhiyuan> Li.Zuochen.MS <[email protected]> 于2021年12月15日周三 22:16写道: > APISIX 老师,你好 > > APISIX真的是很出色的网关组件,我们正在尝试使用,感谢你们。 > > 我遇到如下问题,使用kafka-logger插件,已经输出日志到kafka,但是想补获更多日志细节,包括网关的response、调用upstream > 的请求和返回、时间的格式化。 > > 我现在的配置如下: > > { > > "uri": "/uploadVIPOrder", > > "name": "EStore2Spres-VIPOrder", > > "priority": 1, > > "methods": [ > > "POST" > > ], > > "plugins": { > > "kafka-logger": { > > "batch_max_size": 1, > > "broker_list": { > > "10.92.0.43": 9092, > > "10.92.0.47": 9092, > > "10.92.0.48": 9092 > > }, > > "disable": false, > > "inactive_timeout": 10, > > "include_req_body": true, > > "kafka_topic": "otd-apigateway", > > *"log_format"**: { //**格式化时间、实际客户端**ip**,但是时间一直都是时间戳* > > *"client_ip"**: **"$realip_remote_addr"**,* > > *"host"**: **"$host"**,* > > *"timestamp"**: **"$time_iso8601"**,* > > *"upstream_response_time"**: **"$upstream_response_time"* > > * },* > > "meta_format": "default", > > "name": "EStore2Spres-VIPOrder", > > "producer_type": "async", > > "required_acks": 0 > > }, > > "key-auth": { > > "disable": false > > }, > > "proxy-rewrite": { > > "headers": { > > "proxy_pass": XXXX > > }, > > "host": "XXX", > > "uri": "/serviceProxy/spres/unauthorized/getCustomerDate" > > } > > }, > > "upstream_id": "384757350679970594", > > "labels": { > > "API_VERSION": "v1", > > "desc": "XXX", > > "env": "test" > > }, > > "status": 1 > > } > > > > 返回的日志如下: > > > > 详细的日志如下: > > > > { > > "latency": 161.99994087219, > > "server": { > > "hostname": "otd-nomp-mvp-07", > > "version": "2.10.1" > > }, > > "response": { > > "status": 200, > > "size": 240, > > "headers": { > > "x-request-id": "399b8e6e-dad5-4dcf-8539-dacb844ce915", > > "server": "APISIX/2.10.1", > > "content-type": "text/plain;charset\u003dUTF-8", > > "content-length": "27", > > "date": "Wed, 15 Dec 2021 06:09:12 GMT", > > "connection": "close" > > } > > }, > > "client_ip": "10.228.1.132", > > "route_id": "384757896711242530", > > "upstream": "XXX", > > "start_time": 1639548552809, > > "consumer": { > > "update_time": 1639011748, > > "username": "auth_key_consumer", > > "id": "auth_key_consumer", > > "create_time": 1638886374, > > "auth_conf": { > > "disable": false, > > "key": "XX" > > }, > > "consumer_name": "auth_key_consumer", > > "plugins": { > > "key-auth": { > > "disable": false, > > "key": "XXX" > > } > > } > > }, > > "request": { > > "uri": "/uploadVIPOrder", > > "url": XXXX, > > "body": "{\r\n \"salesOrderType\": \"留学生\",\r\n \"tradeCode\": > \"DLXS\",\r\n \"createTime\": \"2021-10-22 13:54:40\"\r\n}", > > "headers": { > > "accept": "*/*", > > "content-type": "application/json", > > "cache-control": "no-cache", > > "postman-token": "0eb02c62-3305-4d58-b4c8-a59ad2f2a891", > > "host": "XXX", > > "accept-encoding": "gzip, deflate, br", > > "x-request-id": "399b8e6e-dad5-4dcf-8539-dacb844ce915", > > "apikey": "XXX", > > "connection": "keep-alive", > > "proxy_pass":XXXX, > > "content-length": "984", > > "user-agent": "PostmanRuntime/7.28.4" > > }, > > "size": 1328, > > "querystring": {}, > > "method": "POST" > > }, > > "service_id": "" > > } > > *感谢!* > > __________________________________________________________________ > > [image: 2019版全称标识(80%)] > > *李佐臣 / Li ZuoChen* > > *管理服务部 Management Service Department* > > *互联应用开发科 数字化研发组(长春)/P-MS-4-/2* > > *电话:0431-85780470【678470】* > > *移动电话: 13804310607* > > *邮箱 E-mail: [email protected] <[email protected]>* > > >
