mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
systemd library conflict with seektail and addmatch
it looks like the core-os systemd library has some issue when using seektail and add match. this patch works around that shortcoming for the time being. Fixes: #3616 Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -54,14 +54,17 @@ func (e EventJournalD) Read(options ReadOptions) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to generate event options")
|
return errors.Wrapf(err, "failed to generate event options")
|
||||||
}
|
}
|
||||||
podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"} //nolint
|
j, err := sdjournal.NewJournal() //nolint
|
||||||
j, err := sdjournal.NewJournal() //nolint
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := j.AddMatch(podmanJournal.String()); err != nil {
|
// TODO AddMatch and Seek seem to conflict
|
||||||
return errors.Wrap(err, "failed to add filter for event log")
|
// Issue filed upstream -> https://github.com/coreos/go-systemd/issues/315
|
||||||
}
|
// Leaving commented code in case upstream fixes things
|
||||||
|
//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")
|
||||||
|
//}
|
||||||
if len(options.Since) == 0 && len(options.Until) == 0 && options.Stream {
|
if len(options.Since) == 0 && len(options.Until) == 0 && options.Stream {
|
||||||
if err := j.SeekTail(); err != nil {
|
if err := j.SeekTail(); err != nil {
|
||||||
return errors.Wrap(err, "failed to seek end of journal")
|
return errors.Wrap(err, "failed to seek end of journal")
|
||||||
@ -96,6 +99,12 @@ func (e EventJournalD) Read(options ReadOptions) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// TODO this keeps us from feeding the podman event parser with
|
||||||
|
// with regular journal content; it can be removed if the above
|
||||||
|
// problem with AddMatch is resolved.
|
||||||
|
if entry.Fields["PODMAN_EVENT"] == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
newEvent, err := newEventFromJournalEntry(entry)
|
newEvent, err := newEventFromJournalEntry(entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// We can't decode this event.
|
// We can't decode this event.
|
||||||
|
Reference in New Issue
Block a user