summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-08-13 12:22:24 -0500
committerMatthew Heon <mheon@redhat.com>2019-08-27 15:46:51 -0400
commitb49ff958d5dfb01a85fb0d5c394b1ba7d9a74d2d (patch)
treef7f0d84733689f6d69b4fd7cd972a1dd89237f6b
parentbbb1ba78d4da3df796b845c67ff477e7cd8563dc (diff)
downloadpodman-b49ff958d5dfb01a85fb0d5c394b1ba7d9a74d2d.tar.gz
podman-b49ff958d5dfb01a85fb0d5c394b1ba7d9a74d2d.tar.bz2
podman-b49ff958d5dfb01a85fb0d5c394b1ba7d9a74d2d.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>
-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 2854e6548..e7e919d6d 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -70,6 +70,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 {