1 simplify logfile rotation
3 we simply rename <logfile> to <logfile>.1. That way we do not need
4 any logrotate script. max_logfile is set to 256MB.
7 Index: new/lib/logger.c
8 ===================================================================
9 --- new.orig/lib/logger.c 2012-07-17 14:40:47.000000000 +0200
10 +++ new/lib/logger.c 2012-07-17 14:42:16.000000000 +0200
12 static pid_t logger_pid;
15 -static int64_t max_logsize = 500 * 1024 * 1024; /*500MB*/
16 +static int64_t max_logsize = 256 * 1024 * 1024; /*256MB*/
18 pthread_mutex_t logsize_lock = PTHREAD_MUTEX_INITIALIZER;
22 if (access(log_nowname, R_OK) == 0) {
23 char old_logfile[256];
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);
34 new_fd = open(log_nowname, O_RDWR | O_CREAT | O_APPEND, 0644);