Add config check to replace processor
Proposed commit message
fixes https://github.com/elastic/beats/issues/38747
This adds a validation method to the config for the replace processor, so we don't get a null pointer deref and explosion in cases where a user hasn't configured a regex pattern.
Checklist
- [x] My code follows the style guidelines of this project
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have made corresponding change to the default configuration files
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have added an entry in
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.
Pinging @elastic/elastic-agent (Team:Elastic-Agent)
This pull request does not have a backport label. If this is a bug or security fix, could you label this PR @fearful-symmetry? 🙏. For such, you'll need to label your PR with:
- The upcoming major version of the Elastic Stack
- The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)
To fixup this pull request, you need to add the backport labels for the needed branches, such as:
-
backport-v8./d.0is the label to automatically backport to the8./dbranch./dis the digit
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)
I think this may be overly strict. The implementation here prevents the use of the replace processor for removing a pattern; it is not possible to express s/<pattern>// while it was previously. The conventional approach of putting the value on a pointer to allow differentiation between an absence and a zero does not work with ucfg, it seems, so the validation would have to be done in code rather than in the struct tag.