-
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
[Filebeat] Fix multiple modules in filebeat.yml #29952
Conversation
This pull request does not have a backport label. Could you fix it @legoguy1000? 🙏
NOTE: |
💔 Tests Failed
Expand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
jenkins run tests |
I would be curious if u have any thoughts on there is a better way of doing this. Converting the registry from a Map to an Array of Maps seems a little jenky due to all the additional loops that I had to add everywhere else to accommodate them. During testing when it was still a map, I was adding numerical suffixes to the module names before adding to the map which then made them unique. Any thoughts on something like that? it would remove the need for all the additional loops. |
I am still thinking. Another issue I found is that pipelines get loaded as many times as the module is configured. It is either problematic because we are overloading Elasticsearch with unnecessary requests. Also, there are module that can affect the pipeline contents with configuration options, so it might be overwritten in a later pipeline loading. It is not yet clear to me what should be the resolution, but I will get back to you with ideas/resolution. Otherwise, your PR is great! I just need a little time to think. |
Should be easy to add a internal check to the |
Yes, the issue already exists in Beats. But I do not want to increase the scope of this PR. I will open an issue in beats to track the problem. I was thinking about the registry and what I came up with is instead of having a list of maps, we can just create actual data type for modules just like for filesets. type Registry struct {
registry []Module
log logp.Logger
}
type Module struct {
filesets []Fileset
config ModuleConfig
} And WDYT? |
@kvch That could probably work. YOur thought for the Fileset struct would be something like below by replacing the
looking at filebeat/fileset/fileset.go and filebeat/fileset/modules.go, looks like the pointer is really just used to get the module name. |
Issue: #30165 |
Exactly. |
Ok, I can try to make that update later today if I get a break. |
@kvch just pushed changes, locally seems to function properly |
jenkins run tests |
filebeat/fileset/modules.go
Outdated
filesets, _ := reg.registry[module] | ||
for name := range filesets { | ||
list = append(list, name) | ||
func (reg *ModuleRegistry) ModuleConfiguredFilesets(module Module) (list []string, err error) { |
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.
Why are we returning an error param in this function? What can return an error? Am I missing something?
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 had to modify the function for it to make sense with the new structure so now the possibility of error no longer exists and I can remove it.
I like your changes, let's see what the CI thinks. |
Please add a changelog entry, then this PR is ready to be merged. |
This pull request is now in conflicts. Could you fix it? 🙏
|
b58e3d6
to
c49678c
Compare
CHANGELOG.next.asciidoc
Outdated
@@ -101,6 +101,13 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...main[Check the HEAD dif | |||
|
|||
- tcp/unix input: Stop accepting connections after socket is closed. {pull}29712[29712] | |||
- Fix using log_group_name_prefix in aws-cloudwatch input. {pull}29695[29695] | |||
- aws-s3: Stop trying to increase SQS message visibility after ReceiptHandleIsInvalid errors. {pull}29480[29480] |
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 please remove the extra changelog entries?
This pull request is now in conflicts. Could you fix it? 🙏
|
Once green, I will merge it. Thanks @legoguy1000 |
@kvch Any thoughts on why the Python Integration tests would have failed?? |
The failures are unrelated to your change. We updated the testing environment because we are releasing a new version. There might be a few hiccups here and there. |
jenkins run tests |
This pull request is now in conflicts. Could you fix it? 🙏
|
The test failures are unrelated. I will disable the Parser test for now in a follow up PR. @legoguy1000 Thanks for your contribution! |
What does this PR do?
Fix the issue when defining multiple of the same module in filebeat.yml
Why is it important?
Checklist
- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
- module: name
configuration has different behaviour betweenmodules.d/module.yml
andfilebeat.yml
#29649Use cases
Screenshots
Logs