diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-24 05:56:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 05:56:18 -0400 |
commit | d956500743829297b43a22e447017fe6319caed5 (patch) | |
tree | d457ce733c4050e4ebec1af156fc97516cec1e8a /libpod | |
parent | c44c298ae7b5ce1da2aeff5b920de65767966007 (diff) | |
parent | 0f708efd8be843e06dd8a0ac68101a875a82c90e (diff) | |
download | podman-d956500743829297b43a22e447017fe6319caed5.tar.gz podman-d956500743829297b43a22e447017fe6319caed5.tar.bz2 podman-d956500743829297b43a22e447017fe6319caed5.zip |
Merge pull request #10996 from cdoern/untilLog
Implemented --until flag for Libpod's Container Logs
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_log_linux.go | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go index 9f9dd3b0d..d4afaa52a 100644 --- a/libpod/container_log_linux.go +++ b/libpod/container_log_linux.go @@ -97,8 +97,6 @@ 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 for { @@ -150,21 +148,10 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption return } - if !afterTimeStamp { - entryTime := time.Unix(0, int64(entry.RealtimeTimestamp)*int64(time.Microsecond)) - if entryTime.Before(options.Since) { - continue - } - 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 + entryTime := time.Unix(0, int64(entry.RealtimeTimestamp)*int64(time.Microsecond)) + if (entryTime.Before(options.Since) && !options.Since.IsZero()) || (entryTime.After(options.Until) && !options.Until.IsZero()) { + continue } - // If we're reading an event and the container exited/died, // then we're done and can return. event, ok := entry.Fields["PODMAN_EVENT"] |