diff --git "a/\346\227\245\345\277\227\347\233\221\346\265\213/README.md" "b/\346\227\245\345\277\227\347\233\221\346\265\213/README.md"
index d7793ca1ebc5e6e0978c49b8227d9398a07fe6b2..58551c49d92a760fdea2bea642f6890c627de80c 100644
--- "a/\346\227\245\345\277\227\347\233\221\346\265\213/README.md"
+++ "b/\346\227\245\345\277\227\347\233\221\346\265\213/README.md"
@@ -2,4 +2,7 @@
     - 补充预定系统对内服务日志的日志监测脚本,获取到错误日志信息会进行收集前后文,并调用钉钉消息发送至钉钉群中。
     - 调整日志监测模块的文件规范路径,补充相关日志打印。
     - 处理日志监测错误异常日志的钉钉发送消息流程,增加预定系统对内外的日志监测,增加通过链接形式打开日志存储的文本数据,支持公网访问。
-    - 补充对外服务的日志监测。
\ No newline at end of file
+    - 补充对外服务的日志监测。
+2. 2025-06-06:
+   - 处理重连一直失败,会无限循环重试。建议加个重试计数器和退避时间增长策略;
+   - 处理运行12小时后被远程主机主动断开连接问题,通过配置 SSH Client 的 keepalive 参数,让连接保持活跃,避免超时断开。
\ No newline at end of file
diff --git "a/\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\347\263\273\347\273\237\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\346\227\245\345\277\227\346\243\200\346\265\213.py" "b/\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\347\263\273\347\273\237\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\346\227\245\345\277\227\346\243\200\346\265\213.py"
index 653fed87a1596095891ccbf853c86ffc22e69bb4..caeeabb7cc4e0c30262c0ac35f85bcbf85077cef 100644
--- "a/\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\347\263\273\347\273\237\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\346\227\245\345\277\227\346\243\200\346\265\213.py"
+++ "b/\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\347\263\273\347\273\237\346\227\245\345\277\227\347\233\221\346\265\213/\351\242\204\345\256\232\346\227\245\345\277\227\346\243\200\346\265\213.py"
@@ -58,8 +58,19 @@ class LogMonitor:
             private_key = paramiko.RSAKey.from_private_key_file(self.private_key_path, password=self.passphrase)
             self.client = paramiko.SSHClient()
             self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-            self.client.connect(self.host, username=self.username, pkey=private_key)
+            self.client.connect(
+                self.host,
+                username=self.username,
+                pkey=private_key,
+                timeout=30,
+                banner_timeout=200,
+                auth_timeout=200
+            )
+
             self.channel = self.client.invoke_shell()
+            self.channel.setblocking(0)  # 设置为非阻塞模式
+            self.channel.transport.set_keepalive(30)  # 每隔 30 秒发一次 keepalive 包
+
             self.channel.send(f"tail -f {self.log_path}\n")
             logging.info(f"Connected to {self.host}, monitoring {self.log_path}")
             return True
@@ -89,24 +100,25 @@ class LogMonitor:
         logging.info(f"停止对日志 {self.log_path} 的监控.")
 
     def _monitor_loop(self):
-        try:
-            while self.collecting:
+        retry_count = 0
+        MAX_RETRY = 5
+        while self.collecting:
+            try:
                 if self.channel.recv_ready():
-                    output = self.channel.recv(1024).decode('utf-8', errors='ignore')
-                    lines = output.strip().split('\n')
-                    for line in lines:
-                        self._process_line(line)
-
+                    ...
                 else:
                     time.sleep(self.check_interval)
-
-        except (paramiko.SSHException, paramiko.socket.error, OSError) as e:
-            logging.info(f"SSH 连接中断: {e}")
-            self.restart_monitoring()
-
-        except Exception as e:
-            logging.info(f"监控过程中发生异常: {e}")
-            self.restart_monitoring()
+                    retry_count = 0  # 成功时重置重试次数
+            except (paramiko.SSHException, paramiko.socket.error, OSError) as e:
+                logging.warning(f"SSH 断开,准备重连... 错误: {e}")
+                self.restart_monitoring()
+
+                retry_count += 1
+                if retry_count > MAX_RETRY:
+                    logging.error("达到最大重试次数,停止监控")
+                    self.stop_monitoring()
+                    return
+                time.sleep(min(5 * retry_count, 60))  # 指数退避
 
     def save_error_contexts_to_json(self):
         # 获取当前脚本所在目录
diff --git "a/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\344\274\232\350\256\256\351\242\204\345\256\232\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" "b/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\344\274\232\350\256\256\351\242\204\345\256\232\346\265\213\350\257\225\347\224\250\344\276\213.xlsx"
index d0e2f10564091b0f8fb6dbd462ff257e12e48ebc..f6a4c07fb12eb461dffc14a60bd6ee3811958978 100644
Binary files "a/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\344\274\232\350\256\256\351\242\204\345\256\232\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" and "b/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\344\274\232\350\256\256\351\242\204\345\256\232\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" differ
diff --git "a/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\351\225\277\345\256\211\345\244\247\345\255\246\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" "b/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\351\225\277\345\256\211\345\244\247\345\255\246\346\265\213\350\257\225\347\224\250\344\276\213.xlsx"
index e4f6e2cbbe843cd5c5d47a720c76e03f5387b610..ea850abdf7c869f0cc5c2ba9c54f742ef09c1045 100644
Binary files "a/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\351\225\277\345\256\211\345\244\247\345\255\246\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" and "b/\351\242\204\345\256\232\347\263\273\347\273\237/\346\265\213\350\257\225\346\225\260\346\215\256/\351\225\277\345\256\211\345\244\247\345\255\246\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" differ