Skip to content

Commit

Permalink
Merge pull request #7893 from ashley-cui/journald
Browse files Browse the repository at this point in the history
Fix Podman logs reading journald
  • Loading branch information
openshift-merge-robot authored Oct 2, 2020
2 parents b58980a + c0d1954 commit 1132bcf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_log_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
var config journal.JournalReaderConfig
if options.Tail < 0 {
config.NumFromTail = math.MaxUint64
config.NumFromTail = 0
} else {
config.NumFromTail = uint64(options.Tail)
}
Expand Down
1 change: 1 addition & 0 deletions test/e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ var _ = Describe("Podman logs", func() {
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
Expect(len(results.OutputToStringArray())).To(Equal(3))
Expect(results.OutputToString()).To(Equal("podman podman podman"))
})

It("using journald tail two lines", func() {
Expand Down
11 changes: 11 additions & 0 deletions test/system/035-logs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,15 @@ ${cid[1]} c
${cid[0]} d" "Sequential output from logs"
}

@test "podman logs over journald" {
msg=$(random_string 20)

run_podman run --name myctr --log-driver journald $IMAGE echo $msg

run_podman logs myctr
is "$output" "$msg" "check that log output equals the container output"

run_podman rm myctr
}

# vim: filetype=sh

0 comments on commit 1132bcf

Please sign in to comment.