Skip to content

Commit 3706d9e

Browse files
committed
[Filebeat][AWS] Fix vpcflow pipeline exception: Cannot invoke "Object.getClass()" because "receiver" is null (#24167)
The pipeline failed with an obscure error.message: `Cannot invoke "Object.getClass()" because "receiver" is null` when the ingested message didn't contain `aws.vpcflow.*` fiels. Filebeat generates documents that lack those fields when parsing lines from a .log file (not .json) that doesn't conform to the expected formats. This happened for empty lines in particular. (cherry picked from commit f4b7a25)
1 parent 04d374e commit 3706d9e

4 files changed

Lines changed: 23 additions & 5 deletions

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
245245
- Fix Logstash module handling of logstash.log.log_event.action field. {issue}20709[20709]
246246
- aws/s3access dataset was populating event.duration using the wrong unit. {pull}23920[23920]
247247
- Zoom module pipeline failed to ingest some chat_channel events. {pull}23904[23904]
248+
- Fix aws/vpcflow generating errors for empty logs or unidentified formats. {pull}24167[24167]
248249

249250
*Heartbeat*
250251

x-pack/filebeat/module/aws/vpcflow/ingest/pipeline.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ processors:
119119
ignore_empty_value: true
120120

121121
- set:
122-
if: "ctx.aws.vpcflow.instance_id != '-'"
122+
if: "ctx.aws?.vpcflow?.instance_id != null && ctx.aws.vpcflow.instance_id != '-'"
123123
field: cloud.instance.id
124124
value: "{{aws.vpcflow.instance_id}}"
125125
ignore_empty_value: true
@@ -131,11 +131,9 @@ processors:
131131
- script:
132132
lang: painless
133133
ignore_failure: true
134+
if: "ctx.aws?.vpcflow?.tcp_flags != null"
134135
source: |
135-
if (ctx?.aws?.vpcflow?.tcp_flags == null)
136-
return;
137-
138-
if (ctx?.aws?.vpcflow?.tcp_flags_array == null) {
136+
if (ctx.aws.vpcflow.tcp_flags_array == null) {
139137
ArrayList al = new ArrayList();
140138
ctx.aws.vpcflow.put("tcp_flags_array", al);
141139
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Phony unsupported log format.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"cloud.provider": "aws",
4+
"event.category": "network_traffic",
5+
"event.dataset": "aws.vpcflow",
6+
"event.kind": "event",
7+
"event.module": "aws",
8+
"event.original": "Phony unsupported log format.",
9+
"event.type": "flow",
10+
"fileset.name": "vpcflow",
11+
"input.type": "log",
12+
"log.offset": 0,
13+
"service.type": "aws",
14+
"tags": [
15+
"forwarded"
16+
]
17+
}
18+
]

0 commit comments

Comments
 (0)