log death reason of file reader if available (#2721)
This commit is contained in:
parent
48f011dc1c
commit
fd309134a2
|
@ -453,9 +453,14 @@ func (f *FileSource) tailFile(out chan types.Event, t *tomb.Tomb, tail *tail.Tai
|
|||
}
|
||||
return nil
|
||||
case <-tail.Dying(): //our tailer is dying
|
||||
logger.Warningf("File reader of %s died", tail.Filename)
|
||||
t.Kill(fmt.Errorf("dead reader for %s", tail.Filename))
|
||||
return fmt.Errorf("reader for %s is dead", tail.Filename)
|
||||
err := tail.Err()
|
||||
errMsg := fmt.Sprintf("file reader of %s died", tail.Filename)
|
||||
if err != nil {
|
||||
errMsg = fmt.Sprintf(errMsg+" : %s", err)
|
||||
}
|
||||
logger.Warningf(errMsg)
|
||||
t.Kill(fmt.Errorf(errMsg))
|
||||
return fmt.Errorf(errMsg)
|
||||
case line := <-tail.Lines:
|
||||
if line == nil {
|
||||
logger.Warningf("tail for %s is empty", tail.Filename)
|
||||
|
|
Loading…
Reference in a new issue