import os # Path to the text log file LOG_FILE = r"Y:\Projects\Microsoft\Event Viewer\20251128.securityLogs.txt" def search_event_id(event_id): if not os.path.exists(LOG_FILE): print(f"Error: {LOG_FILE} not found.") return print(f"\n--- Searching for Event ID {event_id} in {LOG_FILE} ---\n") matches_found = False with open(LOG_FILE, "r", encoding="utf-8", errors="ignore") as f: for line in f: if event_id in line: print(line.strip()) matches_found = True if not matches_found: print(f"No matches found for Event ID {event_id}.") def main(): event_id = input("Enter Windows Event ID Number: ").strip() search_event_id(event_id) if __name__ == "__main__": main()