import re, collections LOG = r"G:\WEB-SERVER\htdocs\AttendanceHub\ZKTecoSyncService-V2\publish\logs\attendancehub_sync.log" LO, HI = "21:15", "21:32" kinds = ["SESSION_READ_RECREATE", "SESSION_LIVE_RECREATE", "READ_FAILURE", "READ_RETRY_EXHAUSTED", "PUMP_DEAD", "pump_dead", "CONNECT_FAIL", "LivenessPing ok=False", "evDropped=[1-9]", "LIVE_EVENT_DROP", "RT ", "READ_TIME_WINDOW_REJECTED", "API_UNREACHABLE", "UPLOAD_HTTP", "READ_RECONCILED"] hits = collections.defaultdict(list) health = [] with open(LOG, "r", encoding="utf-8", errors="replace") as f: for ln in f: t = ln[:5] if not (LO <= t <= HI): continue for k in kinds: if k in ln: hits[k].append(ln.rstrip()[:240]) break if "DUAL_HEALTH" in ln: health.append(ln.rstrip()) print(f"=== events {LO}-{HI} ===") for k in kinds: v = hits.get(k, []) if v: print(f"\n --- {k} (n={len(v)}) ---") for x in v[:6]: print(" " + x) print(f"\n=== DUAL_HEALTH in window ({len(health)}) ===") for h in health: print(" " + h[:235]) # find the reconciliation ingest itself print("\n=== READ_RECONCILED / ingested punches around the gap ===") with open(LOG, "r", encoding="utf-8", errors="replace") as f: for ln in f: t = ln[:5] if LO <= t <= HI and ("READ_RECONCILED" in ln or "RECON_PERSIST" in ln or "pin=5148" in ln or "watermark" in ln.lower()): print(" " + ln.rstrip()[:240])