Skip to content
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

Merged
merged 4 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions packages/crowdstrike/_dev/deploy/docker/files/config-alert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rules:
Content-Type:
- application/json
body: |
{"meta":{"query_time":0.017724698,"pagination":{"offset":0,"limit":1,"total":2},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"a21557a2-abd0-4363-9293-727c38084b3b"},"resources":["abc"]}
{"meta":{"query_time":0.017724698,"pagination":{"offset":0,"limit":1,"total":3},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"a21557a2-abd0-4363-9293-727c38084b3b"},"resources":["abc"]}
- path: /alerts/queries/alerts/v2
methods: ['GET']
query_params:
Expand All @@ -31,7 +31,19 @@ rules:
Content-Type:
- application/json
body: |
{"meta":{"query_time":0.017734699,"pagination":{"offset":1,"limit":1,"total":2},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"cc557a2-aad0-4364-9293-727c38084n3b"},"resources":["def"]}
{"meta":{"query_time":0.017734699,"pagination":{"offset":1,"limit":1,"total":3},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"cc557a2-aad0-4364-9293-727c38084n3b"},"resources":["def"]}
- path: /alerts/queries/alerts/v2
methods: ['GET']
query_params:
offset: 2
limit: 1
responses:
- status_code: 200
headers:
Content-Type:
- application/json
body: |
{"meta":{"query_time":0.017733700,"pagination":{"offset":2,"limit":1,"total":2},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"cd657a2-aad0-4364-9293-727c38084f3c"},"resources":[]}
- path: /alerts/entities/alerts/v2
methods: ['POST']
request_body: /.*"abc"*/
Expand Down
16 changes: 14 additions & 2 deletions packages/crowdstrike/_dev/deploy/docker/files/config-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rules:
Content-Type:
- application/json
body: |
{"meta":{"query_time":0.017724698,"pagination":{"offset":0,"limit":1,"total":2},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"a21557a2-abd0-4363-9293-727c38084b3b"},"resources":["abc"]}
{"meta":{"query_time":0.017724698,"pagination":{"offset":0,"limit":1,"total":3},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"a21557a2-abd0-4363-9293-727c38084b3b"},"resources":["abc"]}
- path: /devices/queries/devices/v1
methods: ['GET']
query_params:
Expand All @@ -31,7 +31,19 @@ rules:
Content-Type:
- application/json
body: |
{"meta":{"query_time":0.017724698,"pagination":{"offset":1,"limit":1,"total":2},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"b21557a2-abd0-4363-9293-727c384b3b"},"resources":["def"]}
{"meta":{"query_time":0.017724698,"pagination":{"offset":1,"limit":1,"total":3},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"b21557a2-abd0-4363-9293-727c384b3b"},"resources":["def"]}
- path: /devices/queries/devices/v1
methods: ['GET']
query_params:
offset: 2
limit: 1
responses:
- status_code: 200
headers:
Content-Type:
- application/json
body: |
{"meta":{"query_time":0.017725698,"pagination":{"offset":2,"limit":1,"total":2},"writes":{"resources_affected":0},"powered_by":"detectsapi","trace_id":"a31557a2-abd0-4363-9293-727c384b3b"},"resources":[]}
- path: /devices/entities/devices/v2
methods: ['POST']
request_body: /.*"abc"*/
Expand Down
5 changes: 5 additions & 0 deletions packages/crowdstrike/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.39.1"
changes:
- description: Return empty `events` array when no resources in alert, host.
type: bugfix
link: https://github.com/elastic/integrations/pull/10831
- version: "1.39.0"
changes:
- description: Improve document deduplication behavior.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ program: |
).do_request().as(get_resp, get_resp.StatusCode == 200 ?
bytes(get_resp.Body).decode_json().as(body, {
?"resources": has(body.resources) && body.resources.size() > 0 ? optional.of(body.resources) : optional.none(),
"events": [],
"want_more": ((int(state.offset) + body.resources.size()) < body.meta.pagination.total),
"offset": ((int(state.offset) + body.resources.size()) < body.meta.pagination.total) ?
int(state.offset) + body.resources.size()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ program: |
).do_request().as(get_resp, get_resp.StatusCode == 200 ?
bytes(get_resp.Body).decode_json().as(body, {
?"resources": has(body.resources) && body.resources.size() > 0 ? optional.of(body.resources) : optional.none(),
"events": [],
"want_more": ((int(state.offset) + body.resources.size()) < body.meta.pagination.total),
"offset": ((int(state.offset) + body.resources.size()) < body.meta.pagination.total) ?
int(state.offset) + body.resources.size()
Expand Down
2 changes: 1 addition & 1 deletion packages/crowdstrike/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: crowdstrike
title: CrowdStrike
version: "1.39.0"
version: "1.39.1"
description: Collect logs from Crowdstrike with Elastic Agent.
type: integration
format_version: "3.0.3"
Expand Down