https://gitlab.synchro.net/main/sbbs/-/commit/afa023d64996cc5602080e01
Added Files:
exec/load/dated_log_upgrade.js exec/tests/dated_log/upgrade.js
Modified Files:
ctrl/main.ini docs/v322_new.md exec/update.js src/sbbs3/filedat.c filedat.h load_cfg.c logfile.cpp logfile.h main.cpp src/sbbs3/scfg/scfgindex.h scfgsrvr.c scfgsys.c src/sbbs3/scfgdefs.h scfglib1.c scfgsave.c
Log Message:
Archive and remove dated log files by age; SCFG Log Files sub-menu
The dated log files in data/logs/ (MMDDYY.log, MMDDYY.lol, http-*.log and
the Control Panel's TS/WS/MS/FS logs) were never removed by anything, so
they accumulated forever. Daily maintenance now archives and removes them
by age (mtime), per file name pattern: each [dated_log:<pattern>] section
of main.ini sets the days after which matching files are archived
(archive), the archive format (format: gz, zip, 7z, tgz or tbz; blank for
none) and the days after which they are removed (remove), 0 = never.
Archiving compresses a file and/or moves it to the archive directory
([dir] logs_archive, relative to the data directory); the archived file
keeps the original's mtime, and the original is removed only once the
archive is written. Removal applies to logs/ and the archive directory. Patterns match case-insensitively and only file names in logs/; a pattern
with a path is rejected. A daily run stops after 2 minutes, leaving any
backlog for the next day, and logs a DAILY: summary line. The undated, size-rotated logs (error.log etc.) are not affected.
The stock main.ini archives http-*.log and the Control Panel logs as gz
after 7 days and removes them after 365; MMDDYY.log/.lol are kept. On
upgrade, update.js (exec/load/dated_log_upgrade.js, with a test) adds the missing stock patterns with no ages set, so nothing changes until the
sysop sets them.
create_archive() gains the "gz" format (one compressed file, not an
archive) and now detects a failure in archive_write_close() (e.g. a full
disk), which affected QWK/REP packets, SBBSecho bundles and
Archive.create() as well.
SCFG: System->Advanced Options gets a Log Files sub-menu, last in the
menu, holding the Directory and Maximum File Size (moved there) and the
new Dated Files (pattern list editor) and Archive Directory.
SCFG fix: the directory inputs of Advanced Options (Data, Exec, Mods,
Text and the log files directories) passed the full directory field size
(1023 on Linux) as the input limit for an 81-byte buffer; editing a
directory that already had a value wrote past the buffer (uifc's
ugetstr() terminates the string at the limit), crashing SCFG.
Fixes #1464
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net