From 0ad243a0d3167576eb42f360c0834c6d9f00bc7e Mon Sep 17 00:00:00 2001 From: Mark Huth Date: Wed, 30 Nov 2022 15:36:25 +1000 Subject: [PATCH] Display message when malware scan_timeout aborts scan (#3617) Signed-off-by: Mark Huth (cherry picked from commit 9b1ce43d95f359374f37b8ebd11e07857634b9c1) --- insights/client/apps/malware_detection/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/insights/client/apps/malware_detection/__init__.py b/insights/client/apps/malware_detection/__init__.py index 9b9a0f6d93..9de74860c1 100644 --- a/insights/client/apps/malware_detection/__init__.py +++ b/insights/client/apps/malware_detection/__init__.py @@ -797,6 +797,10 @@ def scan_filesystem(self): dir_scan_end = time.time() logger.info("Scan time for %s: %d seconds", toplevel_dir, (dir_scan_end - dir_scan_start)) + if dir_scan_end - dir_scan_start >= self.scan_timeout - 2: + logger.warning("Scan of %s timed-out and may not have been fully scanned. " + "Consider increasing the scan_timeout value of %d in %s", + toplevel_dir, self.scan_timeout, MALWARE_CONFIG_FILE) fs_scan_end = time.time() logger.info("Filesystem scan time: %s", time.strftime("%H:%M:%S", time.gmtime(fs_scan_end - fs_scan_start))) @@ -860,6 +864,10 @@ def scan_processes(self): pid_scan_end = time.time() logger.info("Scan time for process %s: %d seconds", scan_pid, (pid_scan_end - pid_scan_start)) + if pid_scan_end - pid_scan_start >= self.scan_timeout - 2: + logger.warning("Scan of process %s timed out and may not have been fully scanned. " + "Consider increasing the scan_timeout value of %d in %s", + scan_pid, self.scan_timeout, MALWARE_CONFIG_FILE) pids_scan_end = time.time() logger.info("Processes scan time: %s", time.strftime("%H:%M:%S", time.gmtime(pids_scan_end - pids_scan_start)))