diff --git a/containers/container.go b/containers/container.go index bd15888..35223a6 100644 --- a/containers/container.go +++ b/containers/container.go @@ -982,6 +982,16 @@ func (c *Container) runLogParser(logPath string) { return } + for pid := range c.processes { + if processFlags, err := proc.GetFlags(pid); err == nil { + if processFlags.LogMonitoringDisabled { + klog.InfoS("skipping log monitoring due to COROOT_LOG_MONITORING=disabled", "cg", c.cgroup.Id) + return + } + break + } + } + containerId := string(c.id) if logPath != "" { diff --git a/proc/flags.go b/proc/flags.go index dd29ea1..6a8784a 100644 --- a/proc/flags.go +++ b/proc/flags.go @@ -8,6 +8,7 @@ import ( type Flags struct { EbpfProfilingDisabled bool + LogMonitoringDisabled bool } func GetFlags(pid uint32) (Flags, error) { @@ -33,6 +34,8 @@ func GetFlags(pid uint32) (Flags, error) { switch kv[0] { case "COROOT_EBPF_PROFILING": flags.EbpfProfilingDisabled = strings.Contains(kv[1], "disabled") + case "COROOT_LOG_MONITORING": + flags.LogMonitoringDisabled = strings.Contains(kv[1], "disabled") } } return flags, nil