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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err := j.Close(); err != nil {
|
||||||
|
logrus.Errorf("Unable to close journal :%v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
// match only podman journal entries
|
// match only podman journal entries
|
||||||
podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"}
|
podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"}
|
||||||
if err := j.AddMatch(podmanJournal.String()); err != nil {
|
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 {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to get journal cursor")
|
return errors.Wrap(err, "failed to get journal cursor")
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|
Loading…
Reference in New Issue