Skip to content
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(kafka-logger): support sasl conf #7782

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
40ddca3
feat(kafka-logger): support sasl conf
biubiue Aug 24, 2022
21be757
feat(kafka-logger): doc add sasl conf
biubiue Aug 25, 2022
fad3df6
fix(kafka-logger): doc
biubiue Aug 25, 2022
de82ec3
feat(kafka-logger): test case
biubiue Aug 28, 2022
33cd466
feat(kafka-logger): modify test case code style
biubiue Aug 28, 2022
7e1db99
fix(kafka-logger): test case code style
biubiue Aug 28, 2022
ebeebc8
fix(kafka-logger): test case code style
biubiue Aug 28, 2022
cd68da2
fix(kafka-logger): test case code style
biubiue Aug 28, 2022
0104c5a
fix(kafka-logger): test case code style
biubiue Aug 28, 2022
503011c
Update kafka-logger.t
biubiue Aug 28, 2022
18358aa
fix(kafka-logger): test case
biubiue Sep 1, 2022
3812c9c
fix(kafka-logger): test case
biubiue Sep 1, 2022
c8baf35
Update kafka-logger.t
biubiue Sep 1, 2022
d348987
Update kafka-logger.t
biubiue Sep 1, 2022
72f0d06
Update kafka-logger.t
biubiue Sep 2, 2022
5b7dd8c
fix(kafka-logger): test case
biubiue Sep 6, 2022
9f1817a
fix(kafka-logger): try other actions
biubiue Sep 6, 2022
588bb0f
Update kafka-logger.t
biubiue Sep 6, 2022
3a90b5d
Update kafka-logger.t
biubiue Sep 7, 2022
d10ea12
Update kafka-logger.t
biubiue Sep 7, 2022
70054aa
Update kafka-logger.t
biubiue Sep 7, 2022
35a581b
Update kafka-logger.t
biubiue Sep 7, 2022
9d9f005
fix(kafka-logger): modify sasl_config properties
biubiue Sep 8, 2022
8c41473
Update kafka-logger.md
biubiue Sep 8, 2022
4e1cc34
Update kafka-logger.t
biubiue Sep 9, 2022
ddde433
Update kafka-logger.lua
biubiue Sep 9, 2022
0444c00
Update kafka-logger.md
biubiue Sep 9, 2022
cc90a47
Update kafka-logger.lua
biubiue Sep 9, 2022
290070c
fix(kafka-logger): test case
biubiue Sep 13, 2022
1481240
fix(kafka-logger): test case
biubiue Sep 26, 2022
6968d48
test case
biubiue Sep 26, 2022
11d8dc6
test case
biubiue Sep 27, 2022
8ca60db
test case
biubiue Sep 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apisix/plugins/kafka-logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ local schema = {
},
},
},
sasl_config = {
type = "object",
description = "sasl config",
properties = {
mechanism = { type = "string", description = "mechanism" },
password = { type = "string", description = "password" },
user = { type = "string", description = "user" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields should be required if the sasl config exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields should be required if the sasl config exists?

I modify these fields ,and mark required fields

strategy = { type = "string", description = "strategy" }
}
},
kafka_topic = {type = "string"},
producer_type = {
type = "string",
Expand Down Expand Up @@ -205,7 +215,8 @@ function _M.log(conf, ctx)
for host, port in pairs(conf.broker_list) do
local broker = {
host = host,
port = port
port = port,
sasl_config = conf.sasl_config or nil
biubiue marked this conversation as resolved.
Show resolved Hide resolved
}
core.table.insert(broker_list, broker)
end
Expand Down
5 changes: 5 additions & 0 deletions docs/en/latest/plugins/kafka-logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ It might take some time to receive the log data. It will be automatically sent a
| Name | Type | Required | Default | Valid values | Description |
| ---------------------- | ------- | -------- | -------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| broker_list | object | True | | | List of Kafka brokers (nodes). |
| sasl_config | object | False | | | Kafka sasl conf. |
| sasl_config.mechanism | string | False | | | Kafka mechanism. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the default value here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the default value here.

ok

| sasl_config.password | string | False | | | Kafka password. |
| sasl_config.user | string | False | | | Kafka user. |
| sasl_config.strategy | string | False | | | Kafka strategy. |
| kafka_topic | string | True | | | Target topic to push the logs for organisation. |
| producer_type | string | False | async | ["async", "sync"] | Message sending mode of the producer. |
| required_acks | integer | False | 1 | [0, 1, -1] | Number of acknowledgements the leader needs to receive for the producer to consider the request complete. This controls the durability of the sent records. The attribute follows the same configuration as the Kafka `acks` attribute. See [Apache Kafka documentation](https://kafka.apache.org/documentation/#producerconfigs_acks) for more. |
Expand Down