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 2021/04/26 02:30:44 UTC
[GitHub] [apisix] huangnauh opened a new pull request #4131: change(kafka-logger): add server info to kafka log
huangnauh opened a new pull request #4131:
URL: https://github.com/apache/apisix/pull/4131
Signed-off-by: libo.huang <hu...@gmail.com>
### What this PR does / why we need it:
1. add server info to kafka log
```json
"server": {
"hostname": "localhost",
"version": "2.5"
}
```
### Pre-submission checklist:
* [x] Did you explain what problem does this PR solve? Or what new features have been added?
* [ ] Have you added corresponding test cases?
* [x] Have you modified the corresponding document?
* [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
--
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:
users@infra.apache.org
[GitHub] [apisix] huangnauh commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
huangnauh commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r619984815
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,18 +62,82 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ [
+ {
+ "client_ip": "127.0.0.1",
+ "latency": 493.99995803833,
+ "request": {
+ "headers": {
+ "accept": "*/*",
+ "host": "httpbin.org",
+ "user-agent": "curl/7.29.0"
+ },
+ "method": "GET",
+ "querystring": {
+ "foo1": "bar1",
+ "foo2": "bar2"
+ },
+ "size": 98,
+ "uri": "/get?foo1=bar1&foo2=bar2",
+ "url": "http://httpbin.org:9080/get? foo1=bar1&foo2=bar2"
+ },
+ "response": {
+ "headers": {
+ "access-control-allow-credentials": "true",
+ "access-control-allow-origin": "*",
+ "connection": "close",
+ "content-length": "370",
+ "content-type": "application/json",
+ "date": "Mon, 26 Apr 2021 02:03:27 GMT",
+ "server": "APISIX/2.5"
+ },
+ "size": 595,
+ "status": 200
+ },
+ "route_id": "5",
+ "server": {
+ "hostname": "localhost.localdomain",
+ "version": "2.5"
+ },
+ "service_id": "",
+ "start_time": 1619402607026,
+ "upstream": "34.199.75.4:80"
+ }
+ ]
```
- **origin**:
```http
- GET /hello?ab=cd HTTP/1.1
- host: localhost
- content-length: 6
- connection: close
-
- abcdef
+ GET /get?foo1=bar1&foo2=bar2 HTTP/1.1
+ User-Agent: curl/7.29.0
+ Accept: */*
+ Host: httpbin.org
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Content-Length: 370
+ Connection: keep-alive
+ Date: Mon, 26 Apr 2021 02:03:31 GMT
+ Access-Control-Allow-Origin: *
+ Access-Control-Allow-Credentials: true
+ Server: APISIX/2.5
+
+ {
Review comment:
I changed it to the original example. PTAL
--
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:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r620043789
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,7 +62,44 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ {
Review comment:
Please also do the same change to docs/eh/latest/plugins/kafka-logger.md
--
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:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r619950418
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,18 +62,82 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ [
+ {
+ "client_ip": "127.0.0.1",
+ "latency": 493.99995803833,
+ "request": {
+ "headers": {
+ "accept": "*/*",
+ "host": "httpbin.org",
+ "user-agent": "curl/7.29.0"
+ },
+ "method": "GET",
+ "querystring": {
+ "foo1": "bar1",
+ "foo2": "bar2"
+ },
+ "size": 98,
+ "uri": "/get?foo1=bar1&foo2=bar2",
+ "url": "http://httpbin.org:9080/get? foo1=bar1&foo2=bar2"
+ },
+ "response": {
+ "headers": {
+ "access-control-allow-credentials": "true",
+ "access-control-allow-origin": "*",
+ "connection": "close",
+ "content-length": "370",
+ "content-type": "application/json",
+ "date": "Mon, 26 Apr 2021 02:03:27 GMT",
+ "server": "APISIX/2.5"
+ },
+ "size": 595,
+ "status": 200
+ },
+ "route_id": "5",
+ "server": {
+ "hostname": "localhost.localdomain",
+ "version": "2.5"
+ },
+ "service_id": "",
+ "start_time": 1619402607026,
+ "upstream": "34.199.75.4:80"
+ }
+ ]
```
- **origin**:
```http
- GET /hello?ab=cd HTTP/1.1
- host: localhost
- content-length: 6
- connection: close
-
- abcdef
+ GET /get?foo1=bar1&foo2=bar2 HTTP/1.1
+ User-Agent: curl/7.29.0
+ Accept: */*
+ Host: httpbin.org
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Content-Length: 370
+ Connection: keep-alive
+ Date: Mon, 26 Apr 2021 02:03:31 GMT
+ Access-Control-Allow-Origin: *
+ Access-Control-Allow-Credentials: true
+ Server: APISIX/2.5
+
+ {
Review comment:
We don't have those fields in the output?
--
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:
users@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #4131:
URL: https://github.com/apache/apisix/pull/4131
--
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:
users@infra.apache.org
[GitHub] [apisix] huangnauh commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
huangnauh commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r620099676
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,7 +62,44 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ {
Review comment:
Thanks for the reminder, the documentation has been added
--
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:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r619950418
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,18 +62,82 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ [
+ {
+ "client_ip": "127.0.0.1",
+ "latency": 493.99995803833,
+ "request": {
+ "headers": {
+ "accept": "*/*",
+ "host": "httpbin.org",
+ "user-agent": "curl/7.29.0"
+ },
+ "method": "GET",
+ "querystring": {
+ "foo1": "bar1",
+ "foo2": "bar2"
+ },
+ "size": 98,
+ "uri": "/get?foo1=bar1&foo2=bar2",
+ "url": "http://httpbin.org:9080/get? foo1=bar1&foo2=bar2"
+ },
+ "response": {
+ "headers": {
+ "access-control-allow-credentials": "true",
+ "access-control-allow-origin": "*",
+ "connection": "close",
+ "content-length": "370",
+ "content-type": "application/json",
+ "date": "Mon, 26 Apr 2021 02:03:27 GMT",
+ "server": "APISIX/2.5"
+ },
+ "size": 595,
+ "status": 200
+ },
+ "route_id": "5",
+ "server": {
+ "hostname": "localhost.localdomain",
+ "version": "2.5"
+ },
+ "service_id": "",
+ "start_time": 1619402607026,
+ "upstream": "34.199.75.4:80"
+ }
+ ]
```
- **origin**:
```http
- GET /hello?ab=cd HTTP/1.1
- host: localhost
- content-length: 6
- connection: close
-
- abcdef
+ GET /get?foo1=bar1&foo2=bar2 HTTP/1.1
+ User-Agent: curl/7.29.0
+ Accept: */*
+ Host: httpbin.org
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Content-Length: 370
+ Connection: keep-alive
+ Date: Mon, 26 Apr 2021 02:03:31 GMT
+ Access-Control-Allow-Origin: *
+ Access-Control-Allow-Credentials: true
+ Server: APISIX/2.5
+
+ {
Review comment:
We don't have those fields in the output?
--
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:
users@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r620021235
##########
File path: apisix/utils/log-util.lua
##########
@@ -52,6 +52,10 @@ local function get_full_log(ngx, conf)
headers = ngx.resp.get_headers(),
size = var.bytes_sent
},
+ server = {
+ hostname = core.utils.gethostname(),
+ version = core.version.VERSION
Review comment:
I think it would be better to use `apisix_version` so that it is easier to understand its meaning.
--
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:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r620065439
##########
File path: apisix/utils/log-util.lua
##########
@@ -52,6 +52,10 @@ local function get_full_log(ngx, conf)
headers = ngx.resp.get_headers(),
size = var.bytes_sent
},
+ server = {
+ hostname = core.utils.gethostname(),
+ version = core.version.VERSION
Review comment:
IMHO, since this log comes from APISIX, we don't need a prefix to distinguish it.
--
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:
users@infra.apache.org
[GitHub] [apisix] huangnauh commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
huangnauh commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r619984815
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,18 +62,82 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ [
+ {
+ "client_ip": "127.0.0.1",
+ "latency": 493.99995803833,
+ "request": {
+ "headers": {
+ "accept": "*/*",
+ "host": "httpbin.org",
+ "user-agent": "curl/7.29.0"
+ },
+ "method": "GET",
+ "querystring": {
+ "foo1": "bar1",
+ "foo2": "bar2"
+ },
+ "size": 98,
+ "uri": "/get?foo1=bar1&foo2=bar2",
+ "url": "http://httpbin.org:9080/get? foo1=bar1&foo2=bar2"
+ },
+ "response": {
+ "headers": {
+ "access-control-allow-credentials": "true",
+ "access-control-allow-origin": "*",
+ "connection": "close",
+ "content-length": "370",
+ "content-type": "application/json",
+ "date": "Mon, 26 Apr 2021 02:03:27 GMT",
+ "server": "APISIX/2.5"
+ },
+ "size": 595,
+ "status": 200
+ },
+ "route_id": "5",
+ "server": {
+ "hostname": "localhost.localdomain",
+ "version": "2.5"
+ },
+ "service_id": "",
+ "start_time": 1619402607026,
+ "upstream": "34.199.75.4:80"
+ }
+ ]
```
- **origin**:
```http
- GET /hello?ab=cd HTTP/1.1
- host: localhost
- content-length: 6
- connection: close
-
- abcdef
+ GET /get?foo1=bar1&foo2=bar2 HTTP/1.1
+ User-Agent: curl/7.29.0
+ Accept: */*
+ Host: httpbin.org
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Content-Length: 370
+ Connection: keep-alive
+ Date: Mon, 26 Apr 2021 02:03:31 GMT
+ Access-Control-Allow-Origin: *
+ Access-Control-Allow-Credentials: true
+ Server: APISIX/2.5
+
+ {
Review comment:
I changed it to the original example.
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,18 +62,82 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ [
+ {
+ "client_ip": "127.0.0.1",
+ "latency": 493.99995803833,
+ "request": {
+ "headers": {
+ "accept": "*/*",
+ "host": "httpbin.org",
+ "user-agent": "curl/7.29.0"
+ },
+ "method": "GET",
+ "querystring": {
+ "foo1": "bar1",
+ "foo2": "bar2"
+ },
+ "size": 98,
+ "uri": "/get?foo1=bar1&foo2=bar2",
+ "url": "http://httpbin.org:9080/get? foo1=bar1&foo2=bar2"
+ },
+ "response": {
+ "headers": {
+ "access-control-allow-credentials": "true",
+ "access-control-allow-origin": "*",
+ "connection": "close",
+ "content-length": "370",
+ "content-type": "application/json",
+ "date": "Mon, 26 Apr 2021 02:03:27 GMT",
+ "server": "APISIX/2.5"
+ },
+ "size": 595,
+ "status": 200
+ },
+ "route_id": "5",
+ "server": {
+ "hostname": "localhost.localdomain",
+ "version": "2.5"
+ },
+ "service_id": "",
+ "start_time": 1619402607026,
+ "upstream": "34.199.75.4:80"
+ }
+ ]
```
- **origin**:
```http
- GET /hello?ab=cd HTTP/1.1
- host: localhost
- content-length: 6
- connection: close
-
- abcdef
+ GET /get?foo1=bar1&foo2=bar2 HTTP/1.1
+ User-Agent: curl/7.29.0
+ Accept: */*
+ Host: httpbin.org
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Content-Length: 370
+ Connection: keep-alive
+ Date: Mon, 26 Apr 2021 02:03:31 GMT
+ Access-Control-Allow-Origin: *
+ Access-Control-Allow-Credentials: true
+ Server: APISIX/2.5
+
+ {
Review comment:
I changed it to the original example. PTAL
--
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:
users@infra.apache.org
[GitHub] [apisix] huangnauh commented on a change in pull request #4131: feat(kafka-logger): add server info to kafka log
Posted by GitBox <gi...@apache.org>.
huangnauh commented on a change in pull request #4131:
URL: https://github.com/apache/apisix/pull/4131#discussion_r619984815
##########
File path: docs/zh/latest/plugins/kafka-logger.md
##########
@@ -62,18 +62,82 @@ title: kafka-logger
- **default**:
```json
- {"upstream":"127.0.0.1:1980","start_time":1602211788041,"client_ip":"127.0.0.1","service_id":"","route_id":"1","request":{"querystring":{"ab":"cd"},"size":90,"uri":"\/hello?ab=cd","url":"http:\/\/localhost:1984\/hello?ab=cd","headers":{"host":"localhost","content-length":"6","connection":"close"},"body":"abcdef","method":"GET"},"response":{"headers":{"content-type":"text\/plain","server":"APISIX\/1.5","connection":"close","transfer-encoding":"chunked"},"status":200,"size":153},"latency":99.000215530396}
+ [
+ {
+ "client_ip": "127.0.0.1",
+ "latency": 493.99995803833,
+ "request": {
+ "headers": {
+ "accept": "*/*",
+ "host": "httpbin.org",
+ "user-agent": "curl/7.29.0"
+ },
+ "method": "GET",
+ "querystring": {
+ "foo1": "bar1",
+ "foo2": "bar2"
+ },
+ "size": 98,
+ "uri": "/get?foo1=bar1&foo2=bar2",
+ "url": "http://httpbin.org:9080/get? foo1=bar1&foo2=bar2"
+ },
+ "response": {
+ "headers": {
+ "access-control-allow-credentials": "true",
+ "access-control-allow-origin": "*",
+ "connection": "close",
+ "content-length": "370",
+ "content-type": "application/json",
+ "date": "Mon, 26 Apr 2021 02:03:27 GMT",
+ "server": "APISIX/2.5"
+ },
+ "size": 595,
+ "status": 200
+ },
+ "route_id": "5",
+ "server": {
+ "hostname": "localhost.localdomain",
+ "version": "2.5"
+ },
+ "service_id": "",
+ "start_time": 1619402607026,
+ "upstream": "34.199.75.4:80"
+ }
+ ]
```
- **origin**:
```http
- GET /hello?ab=cd HTTP/1.1
- host: localhost
- content-length: 6
- connection: close
-
- abcdef
+ GET /get?foo1=bar1&foo2=bar2 HTTP/1.1
+ User-Agent: curl/7.29.0
+ Accept: */*
+ Host: httpbin.org
+
+ HTTP/1.1 200 OK
+ Content-Type: application/json
+ Content-Length: 370
+ Connection: keep-alive
+ Date: Mon, 26 Apr 2021 02:03:31 GMT
+ Access-Control-Allow-Origin: *
+ Access-Control-Allow-Credentials: true
+ Server: APISIX/2.5
+
+ {
Review comment:
I changed it to the original example.
--
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:
users@infra.apache.org