performance fix for podman events with large journalds

in the case where the host has a large journald, iterating the journal
without using a Match is very poor performance.  this might be a
temporary fix while we figure out why the systemd library does not seem to
behave properly.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-08-13 12:22:24 -05:00
parent a734b53357
commit bbfc80c579

View File

@ -73,6 +73,11 @@ func (e EventJournalD) Read(options ReadOptions) error {
if err := j.SeekTail(); err != nil {
return errors.Wrap(err, "failed to seek end of journal")
}
} else {
podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"} //nolint
if err := j.AddMatch(podmanJournal.String()); err != nil {
return errors.Wrap(err, "failed to add filter for event log")
}
}
// the api requires a next|prev before getting a cursor
if _, err := j.Next(); err != nil {