diff --git a/.chloggen/filelog-close-empty-err.yaml b/.chloggen/filelog-close-empty-err.yaml new file mode 100755 index 0000000000000..909fd0e6514c4 --- /dev/null +++ b/.chloggen/filelog-close-empty-err.yaml @@ -0,0 +1,20 @@ +# Use this changelog template to create an entry for release notes. +# If your change doesn't affect end users, such as a test fix or a tooling change, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: filelogreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix issue where empty files would not be skipped, resulting in extraneous errors. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [22815] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/pkg/stanza/fileconsumer/file.go b/pkg/stanza/fileconsumer/file.go index f7e1853c860bf..1e7ad414718e5 100644 --- a/pkg/stanza/fileconsumer/file.go +++ b/pkg/stanza/fileconsumer/file.go @@ -211,8 +211,8 @@ func (m *Manager) makeReader(path string) *Reader { // Empty file, don't read it until we can compare its fingerprint if err = file.Close(); err != nil { m.Errorf("problem closing file %s", file.Name()) - return nil } + return nil } // Exclude any empty fingerprints or duplicate fingerprints to avoid doubling up on copy-truncate files