Log file rotate patch

From: Ken Moberg <sf@dont-contact.us>
Date: Wed, 26 Oct 2005 16:09:16 -0700

This is a patch to reduce the outage window during a rotate and to not
abort when the log file system is full.

Ken

------------------------------------------------------------------------------------------------------------------------------------------------------
Index: src/logfile.c
--- base/squid-2.5.STABLE9/src/logfile.c 2003-01-20
10:57:50.000000000 -0800
+++ change/squid-2.5.STABLE9/src/logfile.c 2005-08-18
13:21:28.000000000 -0700
@@ -187,9 +187,18 @@
     int s;
     s = FD_WRITE_METHOD(lf->fd, buf, len);
     fd_bytes(lf->fd, s, FD_WRITE);
- if (s == len)
- return;
- if (!lf->flags.fatal)
- return;
- fatalf("logfileWrite: %s: %s\n", lf->path, xstrerror());
+
+ /*
+ * Don't abort and core dump because we can't write a log file
+ * Something else should come along and free up some space on the
+ * partition.
+ *
+ * if (s == len)
+ * return;
+ * if (!lf->flags.fatal)
+ * return;
+ * fatalf("logfileWrite: %s: %s\n", lf->path, xstrerror());
+ */
+
+ return;
 }
Index: src/main.c
--- base/squid-2.5.STABLE9/src/main.c 2005-02-20 18:55:04.000000000 -0800
+++ change/squid-2.5.STABLE9/src/main.c 2005-10-24 13:26:45.000000000
-0700
@@ -52,6 +52,7 @@
 static volatile int do_shutdown = 0;
 
 static void mainRotate(void);
+static void mini_rotate(void);
 static void mainReconfigure(void);
 static SIGHDLR rotate_logs;
 static SIGHDLR reconfigure;
@@ -397,6 +398,14 @@
 }
 
 static void
+mini_rotate(void)
+{
+ _db_rotate_log(); /* Rotate cache.log */
+ storeLogRotate(); /* Rotate store.log */
+ accessLogRotate(); /* Rotate access.log */
+}
+
+static void
 mainRotate(void)
 {
     icmpClose();
@@ -719,7 +728,8 @@
         mainReconfigure();
         do_reconfigure = 0;
     } else if (do_rotate) {
- mainRotate();
+ /* mainRotate(); */
+ mini_rotate();
         do_rotate = 0;
     } else if (do_shutdown) {
         time_t wait = do_shutdown > 0 ? (int) Config.shutdownLifetime : 0;
Received on Wed Oct 26 2005 - 17:13:57 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Nov 01 2005 - 12:00:07 MST