From 69fffc0039fff65d939a382a15a9a8e2b57f7193 Mon Sep 17 00:00:00 2001 From: Cyril Tovena Date: Fri, 13 Nov 2020 12:23:52 +0100 Subject: [PATCH] Skip journald bad message. Unfortunatelly I can't show the message itself without forking the library we are using. Fixes #2812. Signed-off-by: Cyril Tovena --- pkg/promtail/targets/journal/journaltarget.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/promtail/targets/journal/journaltarget.go b/pkg/promtail/targets/journal/journaltarget.go index be3097126ad30..84f3989ff20b1 100644 --- a/pkg/promtail/targets/journal/journaltarget.go +++ b/pkg/promtail/targets/journal/journaltarget.go @@ -180,9 +180,14 @@ func journalTargetWithReader( } go func() { - err := t.r.Follow(until, ioutil.Discard) - if err != nil && err != sdjournal.ErrExpired { - level.Error(t.logger).Log("msg", "received error during sdjournal follow", "err", err.Error()) + for { + err := t.r.Follow(until, ioutil.Discard) + if err != nil { + if err == sdjournal.ErrExpired || err == io.EOF { + return + } + level.Error(t.logger).Log("msg", "received error during sdjournal follow", "err", err.Error()) + } } }()