[sheepdog] [PATCH] Remove automatic log rotation
Valerio Pachera
sirio81 at gmail.com
Mon Nov 3 11:58:57 CET 2014
Actually sheepdog rotates the log when its size is 500M.
This interfere with the linux distribution logrotate.
When receiving HUP, sheepdog has only to recreate a file
descriptor.
Signed-off-by: Valerio Pachera <sirio81 at gmail.com>
---
lib/logger.c | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/lib/logger.c b/lib/logger.c
index 02bab00..617cd65 100644
--- a/lib/logger.c
+++ b/lib/logger.c
@@ -453,19 +453,6 @@ static void dolog(int prio, const char *func, int line,
static void rotate_log(void)
{
int new_fd;
-
- 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);
- snprintf(old_logfile, sizeof(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);
- rename(log_nowname, old_logfile);
- }
new_fd = open(log_nowname, O_RDWR | O_CREAT | O_APPEND, 0644);
if (new_fd < 0) {
syslog(LOG_ERR, "failed to create new log file\n");
@@ -600,28 +587,9 @@ static void logger(char *log_dir, char *outfile)
while (la->active) {
log_flush();
-
- block_sighup();
-
- if (dst_type == LOG_DST_DEFAULT && max_logsize) {
- off_t offset;
-
- offset = lseek(log_fd, 0, SEEK_END);
- if (offset < 0) {
- syslog(LOG_ERR, "sheep log error\n");
- } else {
- size_t log_size = (size_t)offset;
- if (log_size >= max_logsize)
- rotate_log();
- }
- }
-
- unblock_sighup();
-
if (getppid() != sheep_pid)
/* My parent (sheep process) is dead. */
break;
-
sleep(1);
}
--
1.7.10.4
More information about the sheepdog
mailing list