summaryrefslogtreecommitdiff
path: root/libpod/container_log_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-31 22:05:17 +0100
committerGitHub <noreply@github.com>2019-10-31 22:05:17 +0100
commit2dae2577ccbeef502a8783c892a6c9e346153532 (patch)
tree34bc708c058597eb0e9c82f4cdbc6e308d6b4497 /libpod/container_log_linux.go
parent0bfdeae6ddfab22990eaa472317d65e79a222db3 (diff)
parent11750df51015a675c1145982847e08397c7606ea (diff)
downloadpodman-2dae2577ccbeef502a8783c892a6c9e346153532.tar.gz
podman-2dae2577ccbeef502a8783c892a6c9e346153532.tar.bz2
podman-2dae2577ccbeef502a8783c892a6c9e346153532.zip
Merge pull request #4399 from giuseppe/tail-0
logs: support --tail 0
Diffstat (limited to 'libpod/container_log_linux.go')
-rw-r--r--libpod/container_log_linux.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go
index 8a87a8796..c4acc3d4f 100644
--- a/libpod/container_log_linux.go
+++ b/libpod/container_log_linux.go
@@ -6,6 +6,7 @@ package libpod
import (
"fmt"
"io"
+ "math"
"strings"
"time"
@@ -30,7 +31,11 @@ const (
func (c *Container) readFromJournal(options *logs.LogOptions, logChannel chan *logs.LogLine) error {
var config journal.JournalReaderConfig
- config.NumFromTail = options.Tail
+ if options.Tail < 0 {
+ config.NumFromTail = math.MaxUint64
+ } else {
+ config.NumFromTail = uint64(options.Tail)
+ }
config.Formatter = journalFormatter
defaultTime := time.Time{}
if options.Since != defaultTime {
@@ -54,7 +59,7 @@ func (c *Container) readFromJournal(options *logs.LogOptions, logChannel chan *l
if r == nil {
return errors.Errorf("journal reader creation failed")
}
- if options.Tail == 0 {
+ if options.Tail == math.MaxInt64 {
r.Rewind()
}