beats
beats copied to clipboard
Don't enable default processors if the environment does not require it
Describe the enhancement:
Currently, we always add default processors like in Filebeat here:
https://github.com/elastic/beats/blob/f4374dce89786b1feb7012b1dc984f2435c5a061/x-pack/filebeat/cmd/root.go#L40-L57
Auditbeat:
https://github.com/elastic/beats/blob/f4374dce89786b1feb7012b1dc984f2435c5a061/x-pack/auditbeat/cmd/root.go#L67-L77
Packetbeat:
https://github.com/elastic/beats/blob/f4374dce89786b1feb7012b1dc984f2435c5a061/x-pack/packetbeat/cmd/root.go#L67-L115
Some of the processors like these 3
{"add_cloud_metadata": nil},
{"add_docker_metadata": nil},
{"add_kubernetes_metadata": nil}
depend on the environment where the Beats are running. Which means if our users run the Beats without Docker, or not in the cloud, or not in Kubernetes we end up with spamming debug logs and wasting time on trying to attach metadata to every event.
We should be smarter about enabling these processors and do it only if the environment can provide the metadata that the processors are extracting.
For example, we could add a new function to these heavy processors (their packages) called Probe() bool
that returns true
when it makes sense to run the processor and only then add it on the list.
Describe a specific use case for the enhancement or feature:
When running Elastic Agent on a VM (no Docker) with debug logs on, you'll see:
Docker Integration: Error while extracting container ID from source path: index is out of range for field 'log.file.path'
on every single event.
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)
For agent, configuring which global processors are enabled by default will be enabled by the shipper.
For example, we could add a new function to these heavy processors (their packages) called Probe() bool that returns true when it makes sense to run the processor and only then add it on the list.
I like this idea, generally an agent that needs add_cloud_metadata
is not suddenly going to not need it without being restarted or really being a completely new installation.
In general configuring the of global processors used by default when running the agent will be enabled by the shipper, so I don't feel like we need to prioritize this since the global processor support is probably good enough to start. Standalone Beats already allow this, the default processors are just the ones that happen to be in the reference configuration file and this is the situation agent will be in soon.
Just a small detail @rdner, regarding:
When running Elastic Agent on a VM (no Docker) with debug logs on, you'll see:
On only saw that happening on a VM with Docker installed. I did not test it without Docker installed or with Docker not running.
Hi! We just realized that we haven't looked into this issue in a while. We're sorry!
We're labeling this issue as Stale
to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1
.
Thank you for your contribution!