Skip to content

Commit

Permalink
Merge pull request #8589 from yan12125/container-logs-unix-timestamps
Browse files Browse the repository at this point in the history
Support Unix timestamps for `podman logs --since`
  • Loading branch information
openshift-merge-robot authored Dec 4, 2020
2 parents d1193b1 + e58fb21 commit 05df0c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,11 @@ func ParseInputTime(inputTime string) (time.Time, error) {
}
}

unix_timestamp, err := strconv.ParseInt(inputTime, 10, 64)
if err == nil {
return time.Unix(unix_timestamp, 0), nil
}

// input might be a duration
duration, err := time.ParseDuration(inputTime)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions test/system/035-logs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ load helpers
run_podman logs $cid
is "$output" "$rand_string" "output from podman-logs after container is run"

# test --since with Unix timestamps
run_podman logs --since 1000 $cid

run_podman rm $cid
}

Expand Down

0 comments on commit 05df0c5

Please sign in to comment.