Skip to content

Commit 2b9ed24

Browse files
kvchmergify-bot
authored andcommitted
Use the generic helper for opening file to read in filestream (#29180)
Closes #29113 (cherry picked from commit 24d6bbd)
1 parent cf8c5be commit 2b9ed24

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
200200
- Upgrade azure-eventhub sdk reference, contains potential checkpoint fixes. {pull}28919[28919]
201201
- Revert usageDetails api version to 2019-01-01. {pull}28995[28995]
202202
- Fix `threatintel.misp` filters configuration. {issue}27970[27970]
203+
- Fix opening files on Windows in filestream so open files can be deleted. {issue}29113[29113] {pull}29180[29180]
203204

204205
*Heartbeat*
205206

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)