-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Kafka output] removed regex validation to allow dynamic topic #40415
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
This check was added intentionally to block dynamic topics in Agent, since they can't be carried over in the OTel migration. Has this decision changed? The code looks fine but last I knew there was a business decision not to support it. |
We decided to add it back dynamic topics support. |
libbeat/outputs/kafka/kafka.go
Outdated
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.
trying to undo the changes added here: https://github.com/elastic/beats/pull/37902/files#diff-d8e7a8c5739c80fb30e5c2f22ff87b2c8d476d8e9b71c222f2bcd6b4a6d0c3d6
though the dynamic topic resolution still doesn't seem to work
tested with standalone agent, but the topic resolution doesn't seem to work:
{"log.level":"error","@timestamp":"2024-08-02T12:01:28.385Z","message":"Kafka (topic=%{[data_stream.dataset]}): kafka server: The request attempted to perform an operation on an invalid topic.","component":{"binary":"filebeat","dataset":"elastic_agent.filebeat","id":"log-e1d038f6-44ea-4a4e-bd8c-e03fc4b224ac","type":"log"},"log":{"source":"log-e1d038f6-44ea-4a4e-bd8c-e03fc4b224ac"},"log.logger":"kafka","log.origin":{"file.line":338,"file.name":"kafka/client.go","function":"github.com/elastic/beats/v7/libbeat/outputs/kafka.(*client).errorWorker"},"service.name":"filebeat","ecs.version":"1.6.0","ecs.version":"1.6.0"}
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.
@cmacknz Can I get some help/review on this? I'm not sure why the dynamic topic is not being resolved in agent. Tried to add debug logs locally, but I'm not seeing the buildTopicSelector
function being triggered.
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.
Hmm, I see some things to adjust but nothing that would cause that function not to be hit at all.
How are you testing this? You now need to build x-pack/agentbeat
and copy over the resulting agentbeat
binary, so make sure you are doing that and not copying one of the beat binaries directly.
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 didn't copy anything, I thought the EXTERNAL=false
flag should build and use the local beats
repo. I'll try copying it.
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.
okay I could build beats, copied over to agent and now I can see the dynamic topic resolution works as expected, I'll update the description with screenshots
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.
Probably EXTERNAL=false
isn't updated to be aware of agentbeat yet.
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 think I missed the part where the beats are not rebuilt if it was built already, and the step to copy it over to agent.
This pull request is now in conflicts. Could you fix it? 🙏
|
Co-authored-by: Tiago Queiroz <[email protected]>
Proposed commit message
Removed regex validation to allow dynamic topic.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
To test with a real kafka server, follow this guide: https://hevodata.com/learn/install-kafka-on-mac/#Step_2_Download_Install_Kafka_on_Mac_Manually_or_via_HomeBrew
system.cpu
and started the script to consume messageslocalhost:9092
and topic%{[data_stream.dataset]}
Related issues