Skip to content

Commit

Permalink
Fix Promtail journal seeking known position
Browse files Browse the repository at this point in the history
  • Loading branch information
adityacs committed May 22, 2020
1 parent 360d9a7 commit d42cdb4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/promtail/targets/journaltarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ var defaultJournalEntryFunc = func(c sdjournal.JournalReaderConfig, cursor strin
return nil, err
}

// Just seeking the cursor won't give us the entry. We should call Next() or Previous()
// to get the closest following or the closest preceding entry. We have chosen here to call Next(),
// reason being, if we call Previous() we would re read an already read entry.
// More info here https://www.freedesktop.org/software/systemd/man/sd_journal_seek_cursor.html#
_, err = journal.Next()
if err != nil {
return nil, err
}

return journal.GetEntry()
}

Expand Down

0 comments on commit d42cdb4

Please sign in to comment.