Make log and traffic retention configurable; limit DNS presets to Quad9
- Settings → Data retention: log file size, number of old log files, hourly and daily traffic history. Stored as log and stats in config.json, validated, and applied without a restart; lowering a limit deletes older log files and history after confirmation. - Traffic history is now pruned by time instead of by bucket count. - Server page DNS provider list offers only Quad9 and Custom. Claude-Session: https://claude.ai/code/session_01RAnLbyQZ5ZTA7KqwXP98nw
This commit is contained in:
+12
@@ -76,6 +76,18 @@ func (w *rotatingWriter) Write(p []byte) (int, error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// SetLimits changes rotation size and file count at runtime. Rotated files
|
||||
// beyond the new count are deleted.
|
||||
func (w *rotatingWriter) SetLimits(maxMB, maxFiles int) {
|
||||
w.mu.Lock()
|
||||
defer w.mu.Unlock()
|
||||
w.maxBytes = int64(maxMB) << 20
|
||||
for i := maxFiles + 1; i <= maxLogFiles+1; i++ {
|
||||
_ = os.Remove(fmt.Sprintf("%s.%d", w.path, i))
|
||||
}
|
||||
w.maxFiles = maxFiles
|
||||
}
|
||||
|
||||
func (w *rotatingWriter) Close() error {
|
||||
w.mu.Lock()
|
||||
defer w.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user