From 2bfaf47b17a715f52957378609e80c01fafb52db Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 17 Jul 2012 14:48:09 +0200 Subject: [PATCH] Simplify logfile rotation --- Makefile | 2 +- debian/changelog | 8 +++++ debian/patches/series | 1 + debian/patches/simplify-log-rotation.patch | 34 ++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 debian/patches/simplify-log-rotation.patch diff --git a/Makefile b/Makefile index 34f4dfc..19f97b8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ RELEASE=2.1 PACKAGE=pve-sheepdog -PKGREL=2 +PKGREL=3 SDVER=0.4.0 DEB=${PACKAGE}_${SDVER}-${PKGREL}_amd64.deb diff --git a/debian/changelog b/debian/changelog index eb11040..911d68b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +pve-sheepdog (0.4.0-3) unstable; urgency=low + + * Simplify logfile rotation. We simply rename to + .1. That way we do not need any logrotate script. max_logfile + is set to 256MB. + + -- Proxmox Support Team Tue, 17 Jul 2012 14:47:32 +0200 + pve-sheepdog (0.4.0-2) unstable; urgency=low * update to master branch diff --git a/debian/patches/series b/debian/patches/series index d0de944..2fd04b7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ disable-test-suite.patch fix-manpage-section.patch do-not-install-generic-init-script.patch +simplify-log-rotation.patch diff --git a/debian/patches/simplify-log-rotation.patch b/debian/patches/simplify-log-rotation.patch new file mode 100644 index 0000000..254128b --- /dev/null +++ b/debian/patches/simplify-log-rotation.patch @@ -0,0 +1,34 @@ +simplify logfile rotation + +we simply rename to .1. That way we do not need +any logrotate script. max_logfile is set to 256MB. + + +Index: new/lib/logger.c +=================================================================== +--- new.orig/lib/logger.c 2012-07-17 14:40:47.000000000 +0200 ++++ new/lib/logger.c 2012-07-17 14:42:16.000000000 +0200 +@@ -57,7 +57,7 @@ + static pid_t logger_pid; + static key_t semkey; + +-static int64_t max_logsize = 500 * 1024 * 1024; /*500MB*/ ++static int64_t max_logsize = 256 * 1024 * 1024; /*256MB*/ + + pthread_mutex_t logsize_lock = PTHREAD_MUTEX_INITIALIZER; + +@@ -345,13 +345,7 @@ + + if (access(log_nowname, R_OK) == 0) { + char old_logfile[256]; +- time_t t; +- struct tm tm; +- time(&t); +- localtime_r((const time_t *)&t, &tm); +- sprintf(old_logfile, "%s.%04d-%02d-%02d-%02d-%02d", +- log_nowname, tm.tm_year + 1900, tm.tm_mon + 1, +- tm.tm_mday, tm.tm_hour, tm.tm_min); ++ sprintf(old_logfile, "%s.1", log_nowname); + rename(log_nowname, old_logfile); + } + new_fd = open(log_nowname, O_RDWR | O_CREAT | O_APPEND, 0644); -- 2.39.2