From 23527346905a2728c418170a155d0c24b10f5b25 Mon Sep 17 00:00:00 2001 From: auric Date: Sun, 22 Feb 2026 19:13:06 -0600 Subject: Add log_filter: pluggable per-unit output filter subprocess MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each unit can specify log_filter: pointing to any executable that reads stdin and writes filtered output to stdout. The daemon spawns it once at startup (and on SIGHUP), pipes raw log data through it before ring-buffering and broadcasting to attached clients. filter.c handles spawn (fork/exec with pipes), per-chunk apply (write + poll with 250ms timeout, pass-through on silence/timeout), and stop (SIGTERM + fd cleanup). Filters are stopped and restarted cleanly on SIGHUP alongside log_tail. Bundled filters in filters/: source.py — TF2, GMod: strips server_cvar/stuck/path_goal spam, strips the L MM/DD/YYYY - HH:MM:SS: prefix minecraft.py — vanilla/Paper/Spigot: strips keepAlive, autosave, internal class logs, strips [HH:MM:SS] [thread] prefix terraria.py — vanilla/tModLoader: strips blank lines and mod loading noise during startup Any executable reading stdin/writing stdout works as a custom filter. Co-Authored-By: Claude Sonnet 4.6 --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e10a476..d88caf7 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ DAEMON_SRCS = \ src/client.c \ src/log.c \ src/log_tail.c \ + src/filter.c \ src/console/rcon.c \ src/console/a2s.c @@ -38,6 +39,7 @@ umbrella-cli: $(CLI_OBJS) PREFIX ?= /usr/local CONF_DIR = /etc/umbrella UNITS_DIR = /etc/umbrella/units +FILTER_DIR = /usr/lib/umbrella/filters RUN_DIR = /run/umbrella LOG_DIR = /var/log/umbrella @@ -48,6 +50,10 @@ install: all install -dm755 $(UNITS_DIR) install -dm755 $(RUN_DIR) install -dm755 $(LOG_DIR) + install -dm755 $(FILTER_DIR) + install -Dm755 filters/source.py $(FILTER_DIR)/source.py + install -Dm755 filters/minecraft.py $(FILTER_DIR)/minecraft.py + install -Dm755 filters/terraria.py $(FILTER_DIR)/terraria.py @if [ ! -f $(CONF_DIR)/umbrella.conf ]; then \ install -Dm644 umbrella.conf.example $(CONF_DIR)/umbrella.conf; \ echo "Installed default config to $(CONF_DIR)/umbrella.conf"; \ -- cgit v1.2.3