Skip to content

Commit

Permalink
proc_reader: avoid warning for pid=0
Browse files Browse the repository at this point in the history
In some cases, we try to get the docker of pid=0, which fails and
produces the following warning:
time="2023-10-04T10:27:14Z" level=warning msg="Procfs execve event pods/ identifier error" error="open /procRoot/0/cgroup: no such file or directory"

This warning is confusing, so avoid it by not calling the relevant code
for pid=0.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
  • Loading branch information
kkourt committed Oct 5, 2023
1 parent 57abc5c commit dd578ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/sensors/exec/procevents/proc_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ func pushExecveEvents(p procs) {
m.Kube.NetNS = 0
m.Kube.Cid = 0
m.Kube.Cgrpid = 0
m.Kube.Docker, err = procsDockerId(p.pid)
if err != nil {
logger.GetLogger().WithError(err).Warn("Procfs execve event pods/ identifier error")
if p.pid > 0 {
m.Kube.Docker, err = procsDockerId(p.pid)
if err != nil {
logger.GetLogger().WithError(err).Warn("Procfs execve event pods/ identifier error")
}
}

m.Parent.Pid = p.ppid
Expand Down

0 comments on commit dd578ef

Please sign in to comment.