diff --git a/pkg/cgroup/resolve_container.go b/pkg/cgroup/resolve_container.go index 08664af83b..1f21ab4e1e 100644 --- a/pkg/cgroup/resolve_container.go +++ b/pkg/cgroup/resolve_container.go @@ -230,6 +230,11 @@ func extractPodContainerIDfromPath(path string) (string, error) { if path == unknownPath { return utils.SystemProcessName, fmt.Errorf("failed to find pod's container id") } + // as the container ID is located at the end of the path, we remove the beginning of the string to prevent bugs, as seen in issue #923 + split := strings.Split(path, "/") + size := len(split) + path = split[size-1 : size][0] + cgroup := config.GetCGroupVersion() if regexFindContainerIDPath.MatchString(path) { sub := regexFindContainerIDPath.FindAllString(path, -1)