From 7c3ab2e7c5b13c047690a5358efb422a8bb521bc Mon Sep 17 00:00:00 2001 From: Peter Silva Date: Thu, 10 Oct 2024 14:15:55 -0400 Subject: [PATCH 1/2] replace inflight with fileAgeMin for added clarity --- sarracenia/flowcb/gather/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sarracenia/flowcb/gather/file.py b/sarracenia/flowcb/gather/file.py index 3490ee96f..114e66de1 100755 --- a/sarracenia/flowcb/gather/file.py +++ b/sarracenia/flowcb/gather/file.py @@ -465,7 +465,7 @@ def process_event(self, event, src, dst): age = time.time() - lstat.st_mtime if age < self.o.fileAgeMin: - logger.debug( "%d vs (inflight setting) %d seconds. Too New!" % (age,self.o.fileAgeMin) ) + logger.debug( "%d vs (fileAgeMin setting) %d seconds. Too New!" % (age,self.o.fileAgeMin) ) return (False, []) if self.o.fileAgeMax > 0 and age > self.o.fileAgeMax: From f9b76dd8ab0cb21b6f0e9ccc64f8de54c41806ca Mon Sep 17 00:00:00 2001 From: Reid Sunderland Date: Thu, 10 Oct 2024 19:26:06 +0000 Subject: [PATCH 2/2] Add filepath to Too Old/New logs, remove redundant on_add, add else just in the likely impossible case that something goes wrong with lstat/st_mtime --- sarracenia/flowcb/gather/file.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sarracenia/flowcb/gather/file.py b/sarracenia/flowcb/gather/file.py index 114e66de1..28dd4aaeb 100755 --- a/sarracenia/flowcb/gather/file.py +++ b/sarracenia/flowcb/gather/file.py @@ -69,7 +69,7 @@ class File(FlowCB): also should likely switch from listdir to scandir """ def on_add(self, event, src, dst): - logger.debug("on_add %s %s %s" % ( event, src, dst ) ) + logger.debug("%s %s %s" % ( event, src, dst ) ) self.new_events['%s %s' % (src, dst)] = (event, src, dst) def on_created(self, event): @@ -465,12 +465,15 @@ def process_event(self, event, src, dst): age = time.time() - lstat.st_mtime if age < self.o.fileAgeMin: - logger.debug( "%d vs (fileAgeMin setting) %d seconds. Too New!" % (age,self.o.fileAgeMin) ) + logger.debug("%d vs (fileAgeMin setting) %d seconds. Too New! %s" % (age,self.o.fileAgeMin,src) ) return (False, []) if self.o.fileAgeMax > 0 and age > self.o.fileAgeMax: - logger.debug("%d vs (fileAgeMax setting) %d seconds. Too Old!" % (age,self.o.fileAgeMax) ) + logger.debug("%d vs (fileAgeMax setting) %d seconds. Too Old! %s" % (age,self.o.fileAgeMax,src) ) return (True, []) + else: + logger.debug(f"lstat or st_mtime problem? lstat={lstat}") + logger.debug(f"st_mtime={lstat.st_mtime}") # post it