mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #7893 from ashley-cui/journald
Fix Podman logs reading journald
This commit is contained in:
@ -33,7 +33,7 @@ const (
|
|||||||
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
|
func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOptions, logChannel chan *logs.LogLine) error {
|
||||||
var config journal.JournalReaderConfig
|
var config journal.JournalReaderConfig
|
||||||
if options.Tail < 0 {
|
if options.Tail < 0 {
|
||||||
config.NumFromTail = math.MaxUint64
|
config.NumFromTail = 0
|
||||||
} else {
|
} else {
|
||||||
config.NumFromTail = uint64(options.Tail)
|
config.NumFromTail = uint64(options.Tail)
|
||||||
}
|
}
|
||||||
|
@ -203,6 +203,7 @@ var _ = Describe("Podman logs", func() {
|
|||||||
results.WaitWithDefaultTimeout()
|
results.WaitWithDefaultTimeout()
|
||||||
Expect(results).To(Exit(0))
|
Expect(results).To(Exit(0))
|
||||||
Expect(len(results.OutputToStringArray())).To(Equal(3))
|
Expect(len(results.OutputToStringArray())).To(Equal(3))
|
||||||
|
Expect(results.OutputToString()).To(Equal("podman podman podman"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("using journald tail two lines", func() {
|
It("using journald tail two lines", func() {
|
||||||
|
@ -50,4 +50,15 @@ ${cid[1]} c
|
|||||||
${cid[0]} d" "Sequential output from logs"
|
${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
|
# vim: filetype=sh
|
||||||
|
Reference in New Issue
Block a user