]> git.proxmox.com Git - pve-sheepdog.git/blob - debian/patches/simplify-log-rotation.patch
fix patch
[pve-sheepdog.git] / debian / patches / simplify-log-rotation.patch
1 simplify logfile rotation
2
3 we simply rename <logfile> to <logfile>.1. That way we do not need
4 any logrotate script. max_logfile is set to 256MB.
5
6
7 Index: new/lib/logger.c
8 ===================================================================
9 --- new.orig/lib/logger.c 2013-02-28 07:15:26.000000000 +0100
10 +++ new/lib/logger.c 2013-02-28 07:29:55.000000000 +0100
11 @@ -75,7 +75,7 @@
12 static key_t semkey;
13 static char *log_buff;
14
15 -static int64_t max_logsize = 500 * 1024 * 1024; /*500MB*/
16 +static int64_t max_logsize = 256 * 1024 * 1024; /*500MB*/
17
18 static pthread_mutex_t logsize_lock = PTHREAD_MUTEX_INITIALIZER;
19
20 @@ -243,13 +243,7 @@
21
22 if (access(log_nowname, R_OK) == 0) {
23 char old_logfile[256];
24 - time_t t;
25 - struct tm tm;
26 - time(&t);
27 - localtime_r((const time_t *)&t, &tm);
28 - sprintf(old_logfile, "%s.%04d-%02d-%02d-%02d-%02d",
29 - log_nowname, tm.tm_year + 1900, tm.tm_mon + 1,
30 - tm.tm_mday, tm.tm_hour, tm.tm_min);
31 + sprintf(old_logfile, "%s.1", log_nowname);
32 rename(log_nowname, old_logfile);
33 }
34 new_fd = open(log_nowname, O_RDWR | O_CREAT | O_APPEND, 0644);