Skip to content

Commit fe60a72

Browse files
authored
aws: fix handling of last response body in guardduty data stream (#14525)
The previous code would access .last_response.body.findings and assess its size. However, is the findings field is not present, which is expected in the first part of the chain, the template fails with a map look-up error. Instead, use the index helper to allow us to more gently probe for the presence of the field, only preceeding if it is non-zero. This does not fix the issue, but does allow us to handle it by logic changes in the input.
1 parent 5e5131b commit fe60a72

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/aws/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "3.13.1"
3+
changes:
4+
- description: Avoid updating fleet health status to degraded when Guardduty has no findings.
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/14525
27
- version: "3.13.0"
38
changes:
49
- description: Reduce unnecessary work done in cloudtrail data stream when flattened fields are not required.

packages/aws/data_stream/guardduty/agent/stream/httpjson.yml.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ chain:
8080
target: body.findings
8181
cursor:
8282
last_execution_datetime:
83-
value: '[[if (ne (len .last_response.body.findings) 50)]][[.last_event.updatedAt]][[end]]'
83+
value: '[[with $f := (index .last_response.body "findings")]][[if (ne (len $f) 50)]][[.last_event.updatedAt]][[end]][[end]]'
84+
ignore_empty_value: true
8485
tags:
8586
{{#if preserve_original_event}}
8687
- preserve_original_event

packages/aws/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: 3.3.2
22
name: aws
33
title: AWS
4-
version: 3.13.0
4+
version: 3.13.1
55
description: Collect logs and metrics from Amazon Web Services (AWS) with Elastic Agent.
66
type: integration
77
categories:

0 commit comments

Comments
 (0)