Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Podman logs reading journald #7893

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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