Skip to content

Commit 24d6bbd

Browse files
authored
Use the generic helper for opening file to read in filestream (#29180)
Closes #29113
1 parent 7ad6800 commit 24d6bbd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
192192
- Revert usageDetails api version to 2019-01-01. {pull}28995[28995]
193193
- Fix in `aws-s3` input regarding provider discovery through endpoint {pull}28963[28963]
194194
- Fix `threatintel.misp` filters configuration. {issue}27970[27970]
195+
- Fix opening files on Windows in filestream so open files can be deleted. {issue}29113[29113] {pull}29180[29180]
195196

196197
*Heartbeat*
197198

filebeat/input/filestream/input.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
input "github.com/elastic/beats/v7/filebeat/input/v2"
3030
"github.com/elastic/beats/v7/libbeat/common"
3131
"github.com/elastic/beats/v7/libbeat/common/cleanup"
32+
"github.com/elastic/beats/v7/libbeat/common/file"
3233
"github.com/elastic/beats/v7/libbeat/common/match"
3334
"github.com/elastic/beats/v7/libbeat/feature"
3435
"github.com/elastic/beats/v7/libbeat/logp"
@@ -244,7 +245,7 @@ func (inp *filestream) openFile(log *logp.Logger, path string, offset int64) (*o
244245
}
245246

246247
ok := false
247-
f, err := os.OpenFile(path, os.O_RDONLY, os.FileMode(0))
248+
f, err := file.ReadOpen(path)
248249
if err != nil {
249250
return nil, fmt.Errorf("failed opening %s: %s", path, err)
250251
}

0 commit comments

Comments
 (0)