Skip to content

Commit

Permalink
Remove erroneous status reporting (#42435)
Browse files Browse the repository at this point in the history
This commit removes a redundant status reporting from the Filestream
input. `inp.readFromSource` can only return the error from the
canceler, this error should not be reported to the
manager/Elastic-Agent.

`inp.readFromSource` is called by `filestream.Run`, which is called by
the `startHarvester` function. This function already reports the error
returned by `filestream.Run` and correctly filters out 'context
cancelled' errors.

(cherry picked from commit 1a0a732)
  • Loading branch information
belimawr authored and mergify[bot] committed Jan 28, 2025
1 parent 4b7b380 commit 7f32962
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix Netflow Template Sharing configuration handling. {pull}42080[42080]
- Updated websocket retry error code list to allow more scenarios to be retried which could have been missed previously. {pull}42218[42218]
- In the `streaming` input, prevent panics on shutdown with a null check and apply a consistent namespace to contextual data in debug logs. {pull}42315[42315]
- Remove erroneous status reporting to Elastic-Agent from the Filestream input {pull}42435[42435]
- Fix truncation of bodies in request tracing by limiting bodies to 10% of the maximum file size. {pull}42327[42327]

*Heartbeat*
Expand Down
9 changes: 3 additions & 6 deletions filebeat/input/filestream/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/elastic/beats/v7/libbeat/common/file"
"github.com/elastic/beats/v7/libbeat/common/match"
"github.com/elastic/beats/v7/libbeat/feature"
"github.com/elastic/beats/v7/libbeat/management/status"
"github.com/elastic/beats/v7/libbeat/reader"
"github.com/elastic/beats/v7/libbeat/reader/debug"
"github.com/elastic/beats/v7/libbeat/reader/parser"
Expand Down Expand Up @@ -166,11 +165,9 @@ func (inp *filestream) Run(
})
defer streamCancel()

if err := inp.readFromSource(ctx, log, r, fs.newPath, state, publisher, metrics); err != nil {
ctx.UpdateStatus(status.Degraded, fmt.Sprintf("error while reading from source: %v", err))
return err
}
return nil
// The caller of Run already reports the error and filters out errors that
// must not be reported, like 'context cancelled'.
return inp.readFromSource(ctx, log, r, fs.newPath, state, publisher, metrics)
}

func initState(log *logp.Logger, c loginp.Cursor, s fileSource) state {
Expand Down

0 comments on commit 7f32962

Please sign in to comment.