-
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] backwards compatibility for set processor #20908
Conversation
Pinging @elastic/siem (Team:SIEM) |
b72b450
to
290c0ea
Compare
- "ignore_empty_value" option for the set processor only works on elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch.
290c0ea
to
84cc638
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.
Just a few minor suggestions.
filebeat/fileset/pipelines.go
Outdated
if !ok { | ||
continue | ||
} | ||
newIf := strings.ReplaceAll(val, "{", "") |
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.
How about TrimLeft
and TrimRight
for these two?
filebeat/fileset/pipelines.go
Outdated
newIf = strings.TrimSpace(newIf) | ||
newIf = strings.ReplaceAll(newIf, ".", "?.") | ||
newIf = "ctx?." + newIf + " != null" | ||
logp.Debug("modules", "in pipeline %s replacing unsupported 'ignore_empty_value' with if %s in set processor", pipelineID, newIf) |
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.
logp.Debug("modules", "in pipeline %s replacing unsupported 'ignore_empty_value' with if %s in set processor", pipelineID, newIf) | |
logp.Debug("modules", "In pipeline %s replacing unsupported 'ignore_empty_value' with if %q in set processor", pipelineID, newIf) |
"set": map[string]interface{}{ | ||
"field": "rule.name", | ||
"value": "{{panw.panos.ruleset}}", | ||
"ignore_empty_value": true, |
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.
How about a test case for when the pipeline already has an if
and it has ignore_empty_value
. Perhaps it should just drop the ignore_empty_value
in that case?
CHANGELOG.next.asciidoc
Outdated
@@ -256,6 +256,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d | |||
- Fix long registry migration times. {pull}20717[20717] {issue}20705[20705] | |||
- Fix event types and categories in auditd module to comply with ECS {pull}20652[20652] | |||
- Update documentation in the azure module filebeat. {pull}20815[20815] | |||
- provide backwards compatibility for set processor and elasticsearch less than 7.9.0 {pull}20908[20908] |
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.
- provide backwards compatibility for set processor and elasticsearch less than 7.9.0 {pull}20908[20908] | |
- Provide backwards compatibility for the `set` processor when Elasticsearch is less than 7.9.0. {pull}20908[20908] |
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. Can you try testing the modules locally against 7.8 if you haven't already.
I think if you export TESTING_ENVIRONMENT=latest
and roll back to 7.8 in https://github.com/elastic/beats/blob/master/testing/environments/latest.yml#L6-L29 while running the module tests it will use 7.8.
All tests passed with TESTING_ENVIRONMENT=latest & setting version to 7.8.0 in latest.yml Also tried loading the zeek module against 7.8.1 & 7.9.0 clusters: 7.8.1 clustersetup output
Resulting set processor
7.9.0 clustersetup output
Resulting set processor
|
- "ignore_empty_value" option for the set processor only works on Elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch. (cherry picked from commit 0032c0c)
- "ignore_empty_value" option for the set processor only works on Elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch. (cherry picked from commit 0032c0c)
- "ignore_empty_value" option for the set processor only works on Elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch. (cherry picked from commit 0032c0c)
- "ignore_empty_value" option for the set processor only works on Elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch. (cherry picked from commit 0032c0c) Co-authored-by: Lee Hinman <57081003+leehinman@users.noreply.github.com>
- "ignore_empty_value" option for the set processor only works on Elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch.
…lastic#21084) - "ignore_empty_value" option for the set processor only works on Elasticsearch >= 7.9.0. This change removes that option and replaces it with an if statement if pipeline is loaded on an earlier version of elasticsearch. (cherry picked from commit b6162c4) Co-authored-by: Lee Hinman <57081003+leehinman@users.noreply.github.com>
What does this PR do?
When loading a pipeline this change checks the elasticsearch version
and if the version is less than 7.9.0 it will replace the
"ignore_empty_value" option with an equivalent if statement on the set
processor.
Why is it important?
This allows filebeat > 7.9.0 to be used with older versions of
elasticsearch. Without it the pipelines fail to load because the
option isn't supported.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
run
filebeat modules enable zeek && filebeat -e setup
Logs
Error
With fix: