-
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
libbeat/processors/add_process_metadata: Add default cgroup.regex for add_process_metadata #36484
libbeat/processors/add_process_metadata: Add default cgroup.regex for add_process_metadata #36484
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
|
85db624
to
a626a63
Compare
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
Steps errors
Expand to view the steps failures
|
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
This enabled validation of the regex at configuration loading time. It also fixes an inefficiency where the regex was compiled on every execution.
To avoid a breaking behavior change this checks to see if the configuration specified either cgroup_prefixes or cgroup_regex, and if not it sets a default regex value that will match the same cgroups as the previous default plus more.
This behavior was not specified in the documentation. And it was only applied to cgroup v2 paths. The new default behavior will superceed this.
This test checks that existing configurations with cgroup_prefixes are not broken by the change. In order to make it clear that the defaultCgroupRegex is not being used and that the configured cgroup_prefixes is being honored, use a cgroup path that could never match the defaultCgroupRegex.
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 pushed some changes to implement a default cgroup_regex without breaking existing configs. PTAL
Proposed commit message:
Replace the existing cgroup_prefixes default with a default cgroup_regex. The new default will match the same cgroup paths as the old cgroup_prefixes value plus more. Out of the box it will match cgroup paths from modern Kubernetes and Podman versions. Existing users of cgroup_prefixes and cgroup_regex should see no breaking change.
This removes the undocumented behavior that when cgroup_prefixes was used that it would return a value that matched
[\w]{64}
for cgroup v2 paths. This was inconsistent because it arbitrary applied only to cgroup v2 paths and it could be prone to false matches.
libbeat/processors/add_process_metadata/add_process_metadata_test.go
Outdated
Show resolved
Hide resolved
Fixes: gosigar_cid_provider.go:89:9: type switch on error will fail on wrapped errors. Use errors.As to check for specific errors (errorlint)
16e1e52
to
6be8318
Compare
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.
LGTM
… add_process_metadata (#36484) Replace the existing cgroup_prefixes default with a default cgroup_regex. The new default will match the same cgroup paths as the old cgroup_prefixes value plus more. Out of the box it will match cgroup paths from modern Kubernetes and Podman versions. Existing users of cgroup_prefixes and cgroup_regex should see no breaking change. This removes the undocumented behavior that when cgroup_prefixes was used that it would return a value that matched [\w]{64} for cgroup v2 paths. This was inconsistent because it arbitrary applied only to cgroup v2 paths and it could be prone to false matches. (cherry picked from commit 80ed33b)
… add_process_metadata (elastic#36484) Replace the existing cgroup_prefixes default with a default cgroup_regex. The new default will match the same cgroup paths as the old cgroup_prefixes value plus more. Out of the box it will match cgroup paths from modern Kubernetes and Podman versions. Existing users of cgroup_prefixes and cgroup_regex should see no breaking change. This removes the undocumented behavior that when cgroup_prefixes was used that it would return a value that matched [\w]{64} for cgroup v2 paths. This was inconsistent because it arbitrary applied only to cgroup v2 paths and it could be prone to false matches.
Proposed commit message
Replace the existing cgroup_prefixes default with a default cgroup_regex. The new default will match the same cgroup paths as the old cgroup_prefixes value plus more. Out of the box it will match cgroup paths from modern Kubernetes and Podman versions. Existing users of cgroup_prefixes and cgroup_regex should see no breaking change.
This removes the undocumented behavior that when cgroup_prefixes was used that it would return a value that matched [\w]{64} for cgroup v2 paths. This was inconsistent because it arbitrary applied only to cgroup v2 paths and it could be prone to false matches.
Checklist
- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues