diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 51e6623bb603..80fead3fb4cc 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -192,6 +192,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Revert usageDetails api version to 2019-01-01. {pull}28995[28995] - Fix in `aws-s3` input regarding provider discovery through endpoint {pull}28963[28963] - Fix `threatintel.misp` filters configuration. {issue}27970[27970] +- Fix opening files on Windows in filestream so open files can be deleted. {issue}29113[29113] {pull}29180[29180] *Heartbeat* diff --git a/filebeat/input/filestream/input.go b/filebeat/input/filestream/input.go index c1ba829d65fb..654938869af1 100644 --- a/filebeat/input/filestream/input.go +++ b/filebeat/input/filestream/input.go @@ -29,6 +29,7 @@ import ( input "github.com/elastic/beats/v7/filebeat/input/v2" "github.com/elastic/beats/v7/libbeat/common" "github.com/elastic/beats/v7/libbeat/common/cleanup" + "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/logp" @@ -244,7 +245,7 @@ func (inp *filestream) openFile(log *logp.Logger, path string, offset int64) (*o } ok := false - f, err := os.OpenFile(path, os.O_RDONLY, os.FileMode(0)) + f, err := file.ReadOpen(path) if err != nil { return nil, fmt.Errorf("failed opening %s: %s", path, err) }