promtail: fix infinite loop in file target (fixes #5350) (#6135)

pull/5997/head
Tristan Colgate-McFarlane 4 years ago committed by GitHub
parent f91f6a354b
commit 21f69643b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      clients/pkg/promtail/targets/file/filetarget.go

@ -168,7 +168,11 @@ func (t *FileTarget) run() {
for {
select {
case event := <-t.fileEventWatcher:
case event, ok := <-t.fileEventWatcher:
if !ok {
// fileEventWatcher has been closed
return
}
switch event.Op {
case fsnotify.Create:
t.startTailing([]string{event.Name})

Loading…
Cancel
Save