diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index c960bf88dcd..889063a9dc8 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -51,6 +51,7 @@ https://github.com/elastic/beats/compare/v8.2.0\...main[Check the HEAD diff] *Filebeat* +- [httpsjon] Improved error handling during pagination with chaining & split processor {pull}34127[34127] - [Azure blob storage] Added support for more mime types & introduced offset tracking via cursor state. {pull}33981[33981] - Fix EOF on single line not producing any event. {issue}30436[30436] {pull}33568[33568] - Fix handling of error in states in direct aws-s3 listing input {issue}33513[33513] {pull}33722[33722] diff --git a/x-pack/filebeat/input/httpjson/request.go b/x-pack/filebeat/input/httpjson/request.go index 30ab23b8a44..3a04d0a3d72 100644 --- a/x-pack/filebeat/input/httpjson/request.go +++ b/x-pack/filebeat/input/httpjson/request.go @@ -667,7 +667,12 @@ func (r *requester) processChainPaginationEvents(stdCtx context.Context, trCtx * n += processAndPublishEvents(chainTrCtx, events, publisher, i < len(r.requestFactories), r.log) } - defer httpResp.Body.Close() + defer func() { + if httpResp != nil && httpResp.Body != nil { + httpResp.Body.Close() + } + }() + return n, nil }