summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-10-28 08:54:47 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-11-13 07:11:09 -0500
commit062c88771840f89482c5b16fd6dd4bad25749399 (patch)
tree1cc21355dd1209648219935e2645ffe919f86a96 /libpod
parent8f3fb743ee57964594b36fdffb7b8fc5e3ca3371 (diff)
downloadpodman-062c88771840f89482c5b16fd6dd4bad25749399.tar.gz
podman-062c88771840f89482c5b16fd6dd4bad25749399.tar.bz2
podman-062c88771840f89482c5b16fd6dd4bad25749399.zip
Error logs --follow if events-backend != journald, event-logger=journald
Fixes: https://github.com/containers/podman/issues/11255 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_log_linux.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go
index 4029d0af7..324aa3b98 100644
--- a/libpod/container_log_linux.go
+++ b/libpod/container_log_linux.go
@@ -44,6 +44,12 @@ func (c *Container) initializeJournal(ctx context.Context) error {
}
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
+ // We need the container's events in the same journal to guarantee
+ // consistency, see #10323.
+ if options.Follow && c.runtime.config.Engine.EventsLogger != "journald" {
+ return errors.Errorf("using --follow with the journald --log-driver but without the journald --events-backend (%s) is not supported", c.runtime.config.Engine.EventsLogger)
+ }
+
journal, err := sdjournal.NewJournal()
if err != nil {
return err
@@ -105,12 +111,6 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
return errors.Wrap(cursorError, "initial journal cursor")
}
- // We need the container's events in the same journal to guarantee
- // consistency, see #10323.
- if options.Follow && c.runtime.config.Engine.EventsLogger != "journald" {
- return errors.Errorf("using --follow with the journald --log-driver but without the journald --events-backend (%s) is not supported", c.runtime.config.Engine.EventsLogger)
- }
-
options.WaitGroup.Add(1)
go func() {
defer func() {