#!/usr/bin/env python3 """ Minecraft log filter for Umbrella (vanilla, Paper, Spigot, Fabric, etc.) Strips low-value noise: - keepAlive packet spam (Paper/Spigot debug logs) - Internal class/library log lines - Advancement grant/revoke noise - Saving chunks / autosave lines - UUID cache loading lines Strips the "[HH:MM:SS] [Thread/LEVEL]: " prefix from standard Minecraft log format, since the daemon already timestamps output. Install: /usr/lib/umbrella/filters/minecraft.py Unit YAML: log_filter: /usr/lib/umbrella/filters/minecraft.py """ import sys import re # Standard Minecraft log prefix: [HH:MM:SS] [Server thread/INFO]: PREFIX = re.compile(r'^\[\d{2}:\d{2}:\d{2}\] \[[^\]]+\]: ') SKIP = re.compile( r'keepAlive' # packet keepAlive debug r'|Saving chunks for level' # periodic autosave r'|Saving and pausing game' r'|com\.mojang\.' # internal Mojang class logs r'|RCON Client /' # RCON connection noise r'|RCON Listener' r'|Preparing spawn area' r'|Loading libraries' r'|Loaded \d+ recipes' r'|Loaded \d+ advancements' r'|\[uuid-cache\]' r'|^\s*$' ) for line in sys.stdin: if SKIP.search(line): continue line = PREFIX.sub('', line) sys.stdout.write(line) sys.stdout.flush()