From 954b30568a5e18d5b99b13d9157ae0e902b4bf7b Mon Sep 17 00:00:00 2001
From: Maria Matejka <mq@ucw.cz>
Date: Thu, 19 Mar 2026 12:01:15 +0100
Subject: Log: Set a reasonable lower bound for the log file size limit

The log rotation needs a minimal file size. The 16 kB limit imposed
by this commit effectively allows about 150 lines to fit into one file,
and by that all the accompanying log messages (e.g. with debug latency)
fit into there and don't cause another rotation.

Issue: #370

diff --git a/sysdep/unix/config.Y b/sysdep/unix/config.Y
index f4e70d198..be85848de 100644
--- a/sysdep/unix/config.Y
+++ b/sysdep/unix/config.Y
@@ -48,7 +48,13 @@ syslog_name:
 
 log_limit:
    /* empty */
- | expr text { this_log->limit = $1; this_log->backup = $2; }
+ | expr text {
+     if ($1 < 16384)
+       cf_error("Log file size limit too low, must be at least 16384.");
+
+     this_log->limit = $1;
+     this_log->backup = $2;
+   }
  ;
 
 log_file:
