Skip to content

Commit

Permalink
TELEGRAF-8: Telegraf auto configuration update fails.
Browse files Browse the repository at this point in the history
Telegraf auto configuration update fails when
using 2 named pipes. This commit fixes the issue.
  • Loading branch information
chayan-04 committed Nov 14, 2024
1 parent 6bd9725 commit 785da16
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugins/inputs/tail/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (t *Tail) tailNewFiles(fromBeginning bool) error {
ReOpen: true,
Follow: true,
Location: seek,
MustExist: true,
MustExist: false,
Poll: poll,
Pipe: t.Pipe,
Logger: tail.DiscardingLogger,
Expand All @@ -281,9 +281,6 @@ func (t *Tail) tailNewFiles(fromBeginning bool) error {
t.Log.Debugf("Failed to open file (%s): %v", file, err)
return
}
t.tailers[tailer.Filename] = tailer

t.Log.Debugf("Tail added for %q", file)

parser, err := t.parserFunc()
if err != nil {
Expand Down Expand Up @@ -367,6 +364,12 @@ func (t *Tail) receiver(parser parsers.Parser, tailer *tail.Tail) {
case <-timeout:
}

_, isTailerAdded := t.tailers[tailer.Filename]
if !isTailerAdded {
t.tailers[tailer.Filename] = tailer
t.Log.Debugf("Tail added for %q", tailer.Filename)
}

var text string

if line != nil {
Expand Down

0 comments on commit 785da16

Please sign in to comment.