summaryrefslogtreecommitdiff
path: root/libpod/events/journal_linux.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-08-13 12:22:24 -0500
committerbaude <bbaude@redhat.com>2019-08-14 09:30:12 -0500
commitbbfc80c579c0c3fd8e5bddf8cf88532113df67e9 (patch)
tree04b8e497c776616f324361284e45a741088611e1 /libpod/events/journal_linux.go
parenta734b53357a84d5156e2902113e72d9384f9515b (diff)
downloadpodman-bbfc80c579c0c3fd8e5bddf8cf88532113df67e9.tar.gz
podman-bbfc80c579c0c3fd8e5bddf8cf88532113df67e9.tar.bz2
podman-bbfc80c579c0c3fd8e5bddf8cf88532113df67e9.zip
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>
Diffstat (limited to 'libpod/events/journal_linux.go')
-rw-r--r--libpod/events/journal_linux.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index 3bc3f6de7..470c76959 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -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 {