]> git.proxmox.com Git - pve-sheepdog.git/blob - debian/patches/simplify-log-rotation.patch
bump to 0.5.6
[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 --- a/lib/logger.c
10 +++ b/lib/logger.c
11 @@ -97,7 +97,7 @@ static pid_t logger_pid;
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 @@ -357,14 +357,7 @@ static notrace void rotate_log(void)
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 - snprintf(old_logfile, sizeof(old_logfile),
29 - "%s.%04d-%02d-%02d-%02d-%02d",
30 - log_nowname, tm.tm_year + 1900, tm.tm_mon + 1,
31 - tm.tm_mday, tm.tm_hour, tm.tm_min);
32 + sprintf(old_logfile, "%s.1", log_nowname);
33 rename(log_nowname, old_logfile);
34 }
35 new_fd = open(log_nowname, O_RDWR | O_CREAT | O_APPEND, 0644);