import re, sys p = '/var/www/paymenter/storage/logs/laravel-2026-03-28.log' pat = re.compile(r'^\[(.*?)\]\s+\w+\.ERROR:') errs = [] with open(p, 'r', encoding='utf-8', errors='ignore') as f: for i, l in enumerate(f, 1): if pat.match(l) and 'cron' not in l.lower() and 'Scheduled command' not in l: errs.append((i, l.rstrip())) for i, l in errs[-10:]: print(f'{i}: {l[:400]}')