Add log message when tail is added or removed from a file (#4322)

This commit is contained in:
maxunt 2018-06-29 16:15:33 -07:00 committed by Daniel Nelson
parent 8bf18d6ac7
commit a10262c5d6
1 changed files with 8 additions and 0 deletions

View File

@ -203,6 +203,10 @@ func (l *LogParserPlugin) tailNewfiles(fromBeginning bool) error {
Poll: poll, Poll: poll,
Logger: tail.DiscardingLogger, Logger: tail.DiscardingLogger,
}) })
//add message saying a new tailer was added for the file
log.Printf("D! tail added for file: %v", file)
if err != nil { if err != nil {
l.acc.AddError(err) l.acc.AddError(err)
continue continue
@ -287,6 +291,10 @@ func (l *LogParserPlugin) Stop() {
for _, t := range l.tailers { for _, t := range l.tailers {
err := t.Stop() err := t.Stop()
//message for a stopped tailer
log.Printf("D! tail dropped for file: %v", t.Filename)
if err != nil { if err != nil {
log.Printf("E! Error stopping tail on file %s\n", t.Filename) log.Printf("E! Error stopping tail on file %s\n", t.Filename)
} }