mirror of
https://github.com/containers/podman
synced 2024-10-19 16:54:07 +00:00
close journald when reading
when reading from journald, we need to close the journal handler for events and logging. Fixes: #8864 Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
parent
f261bfc549
commit
002d0d6ee6
|
@ -84,7 +84,11 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := j.Close(); err != nil {
|
||||
logrus.Errorf("Unable to close journal :%v", err)
|
||||
}
|
||||
}()
|
||||
// match only podman journal entries
|
||||
podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"}
|
||||
if err := j.AddMatch(podmanJournal.String()); err != nil {
|
||||
|
@ -112,7 +116,6 @@ func (e EventJournalD) Read(ctx context.Context, options ReadOptions) error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get journal cursor")
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
|
Loading…
Reference in a new issue