Skip to content

Commit

Permalink
Display message when malware scan_timeout aborts scan (#3617)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Huth <[email protected]>
(cherry picked from commit 9b1ce43)
  • Loading branch information
mhuth authored and xiangce committed Nov 30, 2022
1 parent 41eeef9 commit 0ad243a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions insights/client/apps/malware_detection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 0ad243a

Please sign in to comment.