summaryrefslogtreecommitdiff
path: root/libpod/container_log_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-10 06:31:49 -0400
committerGitHub <noreply@github.com>2021-07-10 06:31:49 -0400
commitbef1f03d3ca8bfd90f4cbb295d99bf97df74a815 (patch)
tree79d4a907422c070ec0a2db9628eea170bc16dfaa /libpod/container_log_linux.go
parent24a5eeafc54ef7b1c04bfa8efe78fddd3f7e4014 (diff)
parent4624142c2db039343efc8c9b8070cf1e0d3a7262 (diff)
downloadpodman-bef1f03d3ca8bfd90f4cbb295d99bf97df74a815.tar.gz
podman-bef1f03d3ca8bfd90f4cbb295d99bf97df74a815.tar.bz2
podman-bef1f03d3ca8bfd90f4cbb295d99bf97df74a815.zip
Merge pull request #10868 from cdoern/untilLog
Implemented Until Query Parameter for Containers/logs
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.