diff --git a/checker.py b/checker.py index f2fbb4f..b7408d7 100644 --- a/checker.py +++ b/checker.py @@ -138,13 +138,20 @@ def check_logs(log_handler): try: logs = subprocess.run(['docker', 'logs', '--since', '10m', 'infernet-node'], capture_output=True, text=True, check=True) log_content = clean_ansi(logs.stdout) + + last_subscription_id = None + for line in log_content.splitlines(): + if "Ignored subscription creation" in line and "id=" in line: + id_match = re.search(r'id=(\d+)', line) + if id_match: + last_subscription_id = id_match.group(1) + + if last_subscription_id: + return {"status": f"Subscription: {last_subscription_id}"} + return {"status": "Idle"} + except subprocess.CalledProcessError as e: raise RuntimeError(f"Error running docker logs: {e}") - - for line in log_content.splitlines(): - print(line) - - return {"status": "Idle"} if __name__ == "__main__":