-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: clickhouse logger #6215
feat: clickhouse logger #6215
Conversation
Hi, @spacewander
|
Sorry, it is the bug in our lint script. Fixed in #6239 |
6d728a2
to
c47613a
Compare
c47613a
to
74d59b5
Compare
hi @zhendongcmss CI is broken |
@spacewander @tzssangglass
|
My comments above solved the 401 problem with test 4, you can continue to see the problem with test 5, which is related to the code and configuration. |
cfdc24f
to
22c3fb0
Compare
d8ef45b
to
daedfd1
Compare
daedfd1
to
34f3dcb
Compare
b8852fa
to
bc00ad3
Compare
t/plugin/clickhouse-logger.t
Outdated
"clickhouse body: INSERT INTO t FORMAT JSONEachRow" | ||
"clickhouse headers: X-ClickHouse-Key:a" | ||
"clickhouse headers: X-ClickHouse-User:default" | ||
"clickhouse headers: X-ClickHouse-Database:default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reconsidered the test.
What about using error_log like
Lines 572 to 574 in 537a8da
--- error_log | |
loggly body: {"route_id":"1"} | |
loggly tags: "apisix" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't work. I don't know why. I think --- grep_error_log_out
is easier to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use --- error_log
fialed. https://github.com/apache/apisix/runs/5197064703?check_suite_focus=true#step:14:891
bc00ad3
to
9118fb0
Compare
t/plugin/clickhouse-logger.t
Outdated
}, | ||
"plugins":{ | ||
"clickhouse-logger":{ | ||
"batch_max_size":1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"batch_max_size":1000, | |
"batch_max_size":1, |
So the report can be triggered in the CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there was a timer that called this callback function periodically and also if the batch_max_size value was reached. But I added a wait of --- wait: 5
below, it seem doesn'twork.
041d8b3
to
4ad14a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you apply this patch:
--- t/plugin/clickhouse-logger.t
+++ t/plugin/clickhouse-logger.t
@@ -149,7 +149,9 @@ property "endpoint_addr" is required
"password": "a",
"database": "default",
"logtable": "t",
- "endpoint_addr": "http://127.0.0.1:10420/clickhouse-logger/test"
+ "endpoint_addr": "http://127.0.0.1:10420/clickhouse-logger/test",
+ "batch_max_size":1,
+ "inactive_timeout":1
}
},
"upstream": {
@@ -173,7 +175,7 @@ property "endpoint_addr" is required
},
"plugins":{
"clickhouse-logger":{
- "batch_max_size":1000,
+ "batch_max_size":1,
"max_retry_count":0,
"retry_delay":1,
"ssl_verify":true,
@@ -185,7 +187,7 @@ property "endpoint_addr" is required
"name":"clickhouse-logger",
"database":"default",
"logtable":"t",
- "inactive_timeout":5
+ "inactive_timeout":1
}
},
"id":"1"
@@ -213,7 +215,7 @@ GET /opentracing
opentracing
--- error_log
clickhouse body: INSERT INTO t FORMAT JSONEachRow
-clickhouse headers: X-ClickHouse-Key:a
-clickhouse headers: X-ClickHouse-User:default
-clickhouse headers: X-ClickHouse-Database:default
---- wait: 5
+clickhouse headers: x-clickhouse-key:a
+clickhouse headers: x-clickhouse-user:default
+clickhouse headers: x-clickhouse-database:default
+--- wait: 2
Now the test should pass.
There is another issue, the headers we get are all lowercase.
7f67ae3
4ad14a0
to
7f67ae3
Compare
7f67ae3
to
14e29f5
Compare
14e29f5
to
cede016
Compare
@zhendongcmss |
|
||
## Attributes | ||
|
||
| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zhendongcmss, here have some Chinese 😄 Would you like to translate them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @yzeng25, do you have interest to do this? 🤗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created an issue, let's fix it: #6414
What this PR does / why we need it:
feat: push access log to clickhouse DB
Pre-submission checklist: