Cherry-pick #24810 to 7.x: feat: add support for SCRAM authentication for kafka metricbeat module, fixes #19648 #24889
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #24810 to 7.x branch. Original message:
What does this PR do?
Adds SCRAM authentication for kafka to metricbeat's kafka module. Moves shared code from kafka output plugin to
libbeat/common/kafka/
Why is it important?
Currently metricbeat can't pull metrics from Kafka clusters that require authentication, which is a problem in enterprise environments where authentication is a requirement.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.I think most of this isn't applicable, as this PR virtually just moves files around and makes couple things public in the shared code. This virtually no new code introduced.
Reg. "I have made corresponding changes to the documentation", it seems that none of the kafka module's fields in metricbeat are separately documented. Instead the config.yml is pulled into the asciidoc file, which I updated.
How to test this PR locally
As this PR mostly just moves existing files around and introduces only minimal code changes, the test procedures remain the same as those for #12867 which initially introduced SCRAM code. Though it seems those were not documented at the time. Generally, though, the procedure documented in beats/blob/master/metricbeat/module/kafka/README.md remains the same, with the exception that the test kafka cluster needs to use one of the SCAM mechanisms, eg. in
server.properties
havelistener.name.external.sasl.enabled.mechanisms=SCRAM-SHA-256
configured. (if you external listener is calledEXTERNAL
)Related issues
Use cases
This PR introduces
sasl.mechanism
in metricbeat's kafka input module. It works the same way as the similarly named configuration directive in libbeat's kafka output plugin.