From 2658319224574a54a1c76ee02b6a7f3af5dab068 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 9 Jun 2008 16:38:53 +0200 Subject: made rsyslog tickless in the (usual and default) case that repeated message reduction is turned off. More info: http://blog.gerhards.net/2008/06/coding-to-save-environment.html --- ChangeLog | 3 +++ doc/rsyslog_ng_comparison.html | 4 ++-- tools/syslogd.c | 26 +++++++++++++++++--------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2cc995bd..0304f3ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ Version 3.19.7 (rgerhards), 2008-06-?? check before sending. Credits to Martin Schuette for providing the idea. Details are available at http://blog.gerhards.net/2008/06/reliable-plain-tcp-syslog-once-again.html +- made rsyslog tickless in the (usual and default) case that repeated + message reduction is turned off. More info: + http://blog.gerhards.net/2008/06/coding-to-save-environment.html --------------------------------------------------------------------------- Version 3.19.6 (rgerhards), 2008-06-06 - enhanced property replacer to support multiple regex matches diff --git a/doc/rsyslog_ng_comparison.html b/doc/rsyslog_ng_comparison.html index 72fee210..600875a8 100644 --- a/doc/rsyslog_ng_comparison.html +++ b/doc/rsyslog_ng_comparison.html @@ -120,7 +120,7 @@ based framing on syslog/tcp connections syslog over RELP
-truly reliable message delivery (Why +truly reliable message delivery (Why is plain tcp syslog not reliable?) yes no @@ -583,4 +583,4 @@ the mean time, you may want to read it in parallel. It is available at Balabit's site.

- \ No newline at end of file + diff --git a/tools/syslogd.c b/tools/syslogd.c index 8b829771..7f415f3c 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -2491,15 +2491,22 @@ mainloop(void) struct timeval tvSelectTimeout; BEGINfunc - while(!bFinished){ - /* first check if we have any internal messages queued and spit them out */ - /* TODO: do we need this any longer? I doubt it, but let's care about it - * later -- rgerhards, 2007-12-21 - */ - processImInternal(); + /* first check if we have any internal messages queued and spit them out. We used + * to do that on any loop iteration, but that is no longer necessry. The reason + * is that once we reach this point here, we always run on multiple threads and + * thus the main queue is properly initialized. -- rgerhards, 2008-06-09 + */ + processImInternal(); - /* this is now just a wait */ - tvSelectTimeout.tv_sec = TIMERINTVL; + while(!bFinished){ + /* this is now just a wait - please note that we do use a near-"eternal" + * timeout of 1 day if we do not have repeated message reduction turned on + * (which it is not by default). This enables us to help safe the environment + * by not unnecessarily awaking rsyslog on a regular tick (just think + * powertop, for example). In that case, we primarily wait for a signal, + * but a once-a-day wakeup should be quite acceptable. -- rgerhards, 2008-06-09 + */ + tvSelectTimeout.tv_sec = (bReduceRepeatMsgs == 1) ? TIMERINTVL : 86400 /*1 day*/; tvSelectTimeout.tv_usec = 0; select(1, NULL, NULL, NULL, &tvSelectTimeout); if(bFinished) @@ -2526,7 +2533,8 @@ mainloop(void) * for the time being, I think the remaining risk can be accepted. * rgerhards, 2008-01-10 */ - doFlushRptdMsgs(); + if(bReducedRepeatMsgs == 1) + doFlushRptdMsgs(); if(restart) { dbgprintf("\nReceived SIGHUP, reloading rsyslogd.\n"); -- cgit v1.2.3