From 67c2923313e635bdc951c5144f5365a37687dffe Mon Sep 17 00:00:00 2001 From: iritb Date: Sun, 12 Jan 2025 13:10:44 +0200 Subject: [PATCH] Enhance container ID extraction in ProcessTree and RawEventProcessor for improved clarity and functionality --- ProcessTree.cpp | 3 ++- RawEventProcessor.cpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ProcessTree.cpp b/ProcessTree.cpp index 824a67a..d6c429f 100644 --- a/ProcessTree.cpp +++ b/ProcessTree.cpp @@ -448,6 +448,7 @@ std::shared_ptr ProcessTree::AddProcess(enum ProcessTreeSource // started by a web service or another system service that does not pass the container // ID through the command line arguments. Logger::Info("IB Updating containerid %s from cgroup for process %d, _cgroupContainerId %s, temp cgroupContainerid: %s ", process->_containerid.c_str(), pid, process->_cgroupContainerId.c_str(), cgroupContainerid.c_str()); + auto __cgroupContainerid = ExtractContainerIdFromCgroup(pid); if (process->_containerid.empty()) { if (!cgroupContainerid.empty()) { process->_containerid = cgroupContainerid; @@ -656,7 +657,7 @@ std::string ProcessTree::ExtractContainerIdFromCgroup(const int pid) } containerid = pinfo->container_id(); - Logger::Debug("IB (2) CGroup container id for %d is %s", pid, containerid.c_str()); + Logger::Debug("IB CGroup container id for %d is %s", pid, containerid.c_str()); return containerid; } diff --git a/RawEventProcessor.cpp b/RawEventProcessor.cpp index f9bd775..1ff5846 100644 --- a/RawEventProcessor.cpp +++ b/RawEventProcessor.cpp @@ -57,8 +57,7 @@ void RawEventProcessor::ProcessData(const void* data, size_t data_len) { _pid = get_pid_from_event(event); if (_pid != -1) { if (_processTree) { - auto contId = _processTree->ExtractContainerIdFromCgroup(_pid); - Logger::Debug("IB RawEventProcessor: ProcessData for %d: ContainerId: %s", _pid, contId.c_str()); + auto contId = _processTree->ExtractContainerIdFromCgroup(_pid); } }