Skip to content

Commit

Permalink
Check if Filebeat harvester tries to open named pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kvch committed Aug 6, 2020
1 parent f3fe010 commit 62d932b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions filebeat/input/log/harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,14 @@ func (h *Harvester) shouldExportLine(line string) bool {
// is returned and the harvester is closed. The file will be picked up again the next time
// the file system is scanned
func (h *Harvester) openFile() error {
fi, err := os.Stat(h.state.Source)
if err != nil {
return fmt.Errorf("failed to stat source file %s: %v", h.state.Source, err)
}
if fi.Mode()&os.ModeNamedPipe != 0 {
return fmt.Errorf("failed to open file %s, named pipes are not supported", h.state.Source)
}

f, err := file_helper.ReadOpen(h.state.Source)
if err != nil {
return fmt.Errorf("Failed opening %s: %s", h.state.Source, err)
Expand Down

0 comments on commit 62d932b

Please sign in to comment.