-
Notifications
You must be signed in to change notification settings - Fork 456
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
crowdstrike: Return empty events array when no resources in alert, host. #10831
Conversation
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
🚀 Benchmarks reportTo see the full report comment with |
@@ -75,7 +75,7 @@ program: | | |||
} | |||
) | |||
).as(state, state.with( | |||
!has(state.resources) ? state : // Exit early due to GET failure or no resources to collect. | |||
!has(state.resources) ? {"events": []} : // Exit early due to GET failure or no resources to collect. |
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.
That changes a couple of other things:
- it doesn't return the calculated
want_more
andoffset
(maybe not important) - it doesn't return the error event in the case of a GET failure (important)
I think the change should instead be to insert "events": [],
below the ?"resources"
line.
Same for both data streams.
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.
Nice catch. I updated the CEL code with your suggestion and re-ran the system tests. No error messages in the logs, so its working.
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.
When there are no resources in first API call, current CEL code returns state
Can we mock this in our system test scenario? Like have it return no resources in a response before it returns resources.
I was unable to mock the The issue I had with making it at the beginning was that I am unable to increment |
💚 Build Succeeded
History
|
Quality Gate passedIssues Measures |
Package crowdstrike - 1.39.1 containing this change is available at https://epr.elastic.co/search?package=crowdstrike |
…st. (elastic#10831) Return empty events array when no resources in alert and host data-streams. When there are no resources in first API call, current CEL code returns state. But this state doesn't have events inside it. As per CEL input docs, the events field is necessary. Without this, the errors occur and lead to restarting of input.
Proposed commit message
Return empty
events
array when noresources
inalert
andhost
data-streams.When there are no
resources
in first API call, current CEL code returnsstate
.But this
state
doesn't haveevents
inside it. As per CEL docs, theevents
fieldis necessary. Without this, the following errors appear and lead to restarting of input.
Checklist
changelog.yml
file.How to test this PR locally
By modifying
"resources": []
in theconfig-alert.yml
andconfig-host.yml
:Before: (example with
host
)eval "$(elastic-package stack shellinit)" && elastic-package test system --generate -v --data-streams=host
After:
No error messages in agent logs.
eval "$(elastic-package stack shellinit)" && elastic-package test system --generate -v --data-streams=host,alert