aboutsummaryrefslogtreecommitdiff
path: root/libpod/container_log_linux.go
diff options
context:
space:
mode:
authorcdoern <cdoern@redhat.com>2021-07-06 14:53:56 -0400
committercdoern <cdoern@redhat.com>2021-07-09 12:21:46 -0400
commit4624142c2db039343efc8c9b8070cf1e0d3a7262 (patch)
treeca5af233eb2ed67036eeffa05f939743196fac38 /libpod/container_log_linux.go
parent1a9cb93f16cf19e14581319e2fd1b60e791f74dd (diff)
downloadpodman-4624142c2db039343efc8c9b8070cf1e0d3a7262.tar.gz
podman-4624142c2db039343efc8c9b8070cf1e0d3a7262.tar.bz2
podman-4624142c2db039343efc8c9b8070cf1e0d3a7262.zip
Implemented Until Query Parameter for Containers/logs
compat containers/logs was missing actual usage of until query param. fixes #10859 Signed-off-by: cdoern <cdoern@redhat.com>
Diffstat (limited to 'libpod/container_log_linux.go')
-rw-r--r--libpod/container_log_linux.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go
index 892ee34e3..9f9dd3b0d 100644
--- a/libpod/container_log_linux.go
+++ b/libpod/container_log_linux.go
@@ -97,6 +97,7 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
}
}()
+ beforeTimeStamp := true
afterTimeStamp := false // needed for options.Since
tailQueue := []*logs.LogLine{} // needed for options.Tail
doTail := options.Tail > 0
@@ -156,6 +157,13 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
}
afterTimeStamp = true
}
+ if beforeTimeStamp {
+ entryTime := time.Unix(0, int64(entry.RealtimeTimestamp)*int64(time.Microsecond))
+ if entryTime.Before(options.Until) || !options.Until.IsZero() {
+ continue
+ }
+ beforeTimeStamp = false
+ }
// If we're reading an event and the container exited/died,
// then we're done and can return.