From 7ff4624e67a6452f77d330c84b2ce6aee900b638 Mon Sep 17 00:00:00 2001 From: auric Date: Sun, 22 Feb 2026 22:11:01 -0600 Subject: log_tail: add log_dir + log_pattern directory-watch mode Valve games (TF2, GMod) rotate into a new timestamped log file on every map change. The existing fixed-path inotify watch goes stale after the first rotation. This adds a directory-watch mode that auto-switches to the newest matching file whenever one appears. New YAML fields (mutually exclusive with logs:): log_dir: directory to watch for new log files log_pattern: fnmatch(3) glob for filenames; default "*" Changes: - umbrella.h: add log_dir[MAX_PATH] and log_dir_pattern[MAX_PATH] to Unit - log_tail.c: extend LogWatch with dir_wd/dir_path/pattern fields; add log_tail_drain, log_tail_scan_dir, log_tail_switch_file, log_tail_open_fixed_watch, log_tail_open_dir_watch, log_tail_reopen_fixed, log_tail_handle_rotation_dir; refactor log_tail_init, log_tail_handle, log_tail_cleanup - unit.c: parse log_dir and log_pattern YAML keys; warn and drop logs: if both are set on the same unit - AGENTS.md, README.md: document both log-tail modes Co-Authored-By: Claude Sonnet 4.6 --- src/umbrella.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/umbrella.h') diff --git a/src/umbrella.h b/src/umbrella.h index ff1873f..b0308b5 100644 --- a/src/umbrella.h +++ b/src/umbrella.h @@ -92,6 +92,8 @@ typedef struct { int action_count; char log_filter[MAX_PATH]; /* path to filter executable, or empty */ + char log_dir[MAX_PATH]; /* directory to watch, or "" if not used */ + char log_dir_pattern[MAX_PATH]; /* fnmatch pattern for log files; default "*" */ /* Runtime state (populated by process/rcon layer, not yaml) */ ProcessState state; -- cgit v1.2.3