Skip to content

Commit 86d0ae7

Browse files
committed
run logparser for containerd containers
1 parent 4e92dad commit 86d0ae7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

containers/container.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,8 @@ func (c *Container) runLogParser(logPath string) {
575575
if *flags.NoParseLogs {
576576
return
577577
}
578-
switch {
579-
case logPath != "":
578+
579+
if logPath != "" {
580580
if c.logParsers[logPath] != nil {
581581
return
582582
}
@@ -590,8 +590,11 @@ func (c *Container) runLogParser(logPath string) {
590590
}
591591
klog.InfoS("started varlog logparser", "cg", c.cgroup.Id, "log", logPath)
592592
c.logParsers[logPath] = &LogParser{parser: parser, stop: reader.Stop}
593+
return
594+
}
593595

594-
case c.cgroup.ContainerType == cgroup.ContainerTypeSystemdService:
596+
switch c.cgroup.ContainerType {
597+
case cgroup.ContainerTypeSystemdService:
595598
ch := make(chan logparser.LogEntry)
596599
if err := JournaldSubscribe(c.cgroup, ch); err != nil {
597600
klog.Warningln(err)
@@ -604,7 +607,7 @@ func (c *Container) runLogParser(logPath string) {
604607
klog.InfoS("started journald logparser", "cg", c.cgroup.Id)
605608
c.logParsers["journald"] = &LogParser{parser: parser, stop: stop}
606609

607-
case c.cgroup.ContainerType == cgroup.ContainerTypeDocker:
610+
case cgroup.ContainerTypeDocker, cgroup.ContainerTypeContainerd:
608611
if c.metadata.logPath == "" {
609612
return
610613
}

0 commit comments

Comments
 (0)