Skip to content

Commit

Permalink
fix(inputs.tail): Retry opening file after permission denied (#14357)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmiller-wpengine authored Nov 30, 2023
1 parent e17ee6d commit e4d7be0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/inputs/tail/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ func (t *Tail) tailNewFiles(fromBeginning bool) error {
t.Log.Debugf("Tail removed for %q", tailer.Filename)

if err := tailer.Err(); err != nil {
t.Log.Errorf("Tailing %q: %s", tailer.Filename, err.Error())
if strings.HasSuffix(err.Error(), "permission denied") {
t.Log.Errorf("Deleting tailer for %q due to: %v", tailer.Filename, err)
delete(t.tailers, tailer.Filename)
} else {
t.Log.Errorf("Tailing %q: %s", tailer.Filename, err.Error())
}
}
}()

Expand Down

0 comments on commit e4d7be0

Please sign in to comment.