#!/usr/bin/env python3 import re import ipaddress from datetime import datetime, timezone import os from local import * # Make sure this defines ACCESS_LOG, LOG_DIR, etc. # ==== CONFIGURATION ==== MAX_LOG_LINES = 50000 # adjust as needed LOG_DIR = os.path.join(os.path.dirname(__file__), "logs") os.makedirs(LOG_DIR, exist_ok=True) INTERNAL_NETWORKS = [ ipaddress.ip_network("10.0.0.0/8"), ipaddress.ip_network("192.168.0.0/16"), ipaddress.ip_network("172.16.0.0/12"), ] log_line_re = re.compile( r'(?P\S+) - - \[(?P