summaryrefslogtreecommitdiff
path: root/libpod/events/journal_linux.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-01 09:33:02 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-06-02 13:37:56 +0200
commit37f39eefee72ec4fb6c6bd71642e9d384c448387 (patch)
treeb92e5c34040d2843af14f0892e4165d0d1c17380 /libpod/events/journal_linux.go
parent8f5f0cf44898a5785a0fb2cf814969e13ab17a3c (diff)
downloadpodman-37f39eefee72ec4fb6c6bd71642e9d384c448387.tar.gz
podman-37f39eefee72ec4fb6c6bd71642e9d384c448387.tar.bz2
podman-37f39eefee72ec4fb6c6bd71642e9d384c448387.zip
events: support disjunctive filters
While different filters are applied in conjunction, the same filter (but with different values) should be applied in disjunction. This allows, for instance, to query the events of two containers. Fixes: #10507 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/events/journal_linux.go')
-rw-r--r--libpod/events/journal_linux.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index 23e5f15b1..7006290e9 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -69,9 +69,9 @@ func (e EventJournalD) Write(ee Event) error {
// Read reads events from the journal and sends qualified events to the event channel
func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
defer close(options.EventChannel)
- eventOptions, err := generateEventOptions(options.Filters, options.Since, options.Until)
+ filterMap, err := generateEventFilters(options.Filters, options.Since, options.Until)
if err != nil {
- return errors.Wrapf(err, "failed to generate event options")
+ return errors.Wrapf(err, "failed to parse event filters")
}
var untilTime time.Time
if len(options.Until) > 0 {
@@ -159,11 +159,7 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
}
continue
}
- include := true
- for _, filter := range eventOptions {
- include = include && filter(newEvent)
- }
- if include {
+ if applyFilters(newEvent, filterMap) {
options.EventChannel <- newEvent
}
}