diff --git a/socs/agents/bluefors/agent.py b/socs/agents/bluefors/agent.py index fbb410991..77a7f8a8d 100644 --- a/socs/agents/bluefors/agent.py +++ b/socs/agents/bluefors/agent.py @@ -380,7 +380,13 @@ def read_and_publish_logs(self, app_session): new = self.log_tracker.reopen_file(k) LOG.debug("File: {f}, Line: {l}", f=k, l=new) else: - new = v['file_object'].readline() + try: + new = v['file_object'].readline() + except OSError as e: + LOG.warn(f"Unable to read line from {k} due to error: '{e}'. " + + "Reopening file.") + # Error likely caused by improperly closed file, so reopen it + new = self.log_tracker.reopen_file(k) if new == '': continue