Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd library conflict with seektail and addmatch #3745

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions libpod/events/journal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ func (e EventJournalD) Read(options ReadOptions) error {
if err != nil {
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 {
return err
}
if err := j.AddMatch(podmanJournal.String()); err != nil {
return errors.Wrap(err, "failed to add filter for event log")
}
// TODO AddMatch and Seek seem to conflict
// 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 err := j.SeekTail(); err != nil {
return errors.Wrap(err, "failed to seek end of journal")
Expand Down Expand Up @@ -96,6 +99,12 @@ func (e EventJournalD) Read(options ReadOptions) error {
if err != nil {
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)
if err != nil {
// We can't decode this event.
Expand Down