Skip to content

Commit

Permalink
Add guard against missing elements in codec payload (elastic#10938)
Browse files Browse the repository at this point in the history
Due to a bug in Logstash (elastic/logstash#16410),
when configuring a codec with optional settings, the stats do not get generated,
causing the data collection for codecs, and thus plugins to fail.

This commit adds a guard to the retrieval of `encode` and `decode` to ensure
that the CEL input does not fail when encountering this issue
  • Loading branch information
robbavey authored Oct 3, 2024
1 parent 1d292a1 commit 3d615b8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
5 changes: 5 additions & 0 deletions packages/logstash/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "2.4.11"
changes:
- description: Guard against missing elements in codec payload
type: bugfix
link: https://github.com/elastic/integrations/pull/10938
- version: "2.4.10"
changes:
- description: Add Pipeline information to Pipelines View page
Expand Down
34 changes: 19 additions & 15 deletions packages/logstash/data_stream/plugins/agent/stream/cel.yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,26 @@ program: |
"plugin": {
"type": "codec",
"codec": {
"id":codec.id,
"name":codec.name,
"id":codec.id,
"name":codec.name,
"flow": has(codec.flow) ? codec.flow : {},
"decode":{
"duration":{
"ms":codec.decode.duration_in_millis
},
"in":codec.decode.writes_in,
"out":codec.decode.out,
},
"encode":{
"in":codec.encode.writes_in,
"duration":{
"ms":codec.encode.duration_in_millis
}
}
"decode": has(codec.decode) ?
{
"duration":{
"ms":codec.decode.duration_in_millis
},
"in":codec.decode.writes_in,
"out":codec.decode.out,
} :
{},
"encode": has(codec.encode) ?
{
"in":codec.encode.writes_in,
"duration":{
"ms":codec.encode.duration_in_millis
}
} :
{}
}
}
}.drop_empty()),
Expand Down
2 changes: 1 addition & 1 deletion packages/logstash/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: logstash
title: Logstash
version: 2.4.10
version: 2.4.11
description: Collect logs and metrics from Logstash with Elastic Agent.
type: integration
icons:
Expand Down

0 comments on commit 3d615b8

Please sign in to comment.