PR feedback

pull/489/head
Edward Welch 6 years ago committed by Ed
parent 354427242b
commit 4b8eda64f5
  1. 13
      pkg/promtail/positions/positions.go
  2. 3
      pkg/promtail/targets/filetarget.go

@ -127,15 +127,16 @@ func (p *Positions) save() {
func (p *Positions) cleanup() {
for k := range p.positions {
if _, err := os.Stat(k); err == nil {
// File still exists.
} else if os.IsNotExist(err) {
// File no longer exists.
p.Remove(k)
} else {
if _, err := os.Stat(k); err != nil {
if os.IsNotExist(err) {
// File no longer exists.
p.Remove(k)
return
}
// Can't determine if file exists or not, some other error.
level.Warn(p.logger).Log("msg", "could not determine if log file "+
"still exists while cleaning positions file", "error", err)
}
}
}

@ -291,7 +291,8 @@ func (t *FileTarget) reportSizeAndRemoveMissing(ms []string) []string {
for _, m := range ms {
fi, err := os.Stat(m)
if err != nil {
//If we can't stat the file, skip it
level.Warn(t.logger).Log("msg", "failed to stat glob matched file, "+
"file will not be tailed", "file", m, "error", err)
continue
}
mso = append(mso, m)

Loading…
Cancel
Save