From 8bf869fafbcc53a134e2842e4fc894ee27ee1c7f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 29 Nov 2013 15:43:23 +0100 Subject: actions now report if they suspend and resume themselves --- ChangeLog | 3 +++ action.c | 19 ++++++++++++------- action.h | 6 ++---- runtime/glbl.c | 4 ++++ 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8233d8a..6b020dbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ --------------------------------------------------------------------------- Version 7.5.8 [v7-devel] 2013-11-?? +- actions now report if they suspend and resume themselves + this is by default on and controllable by the action.reportSuspension + global parameter - bugfix: mmrfc5424addhmac: "key" parameter was not properly processed - add new impstats action counters: * suspended diff --git a/action.c b/action.c index 23b70885..145856eb 100644 --- a/action.c +++ b/action.c @@ -180,6 +180,7 @@ configSettings_t cs_save; /* our saved (scope!) config settings */ * counting. -- rgerhards, 2008-01-29 */ static int iActionNbr = 0; +int bActionReportSuspension = 1; /* tables for interfacing with the v6 config system */ static struct cnfparamdescr cnfparamdescr[] = { @@ -645,11 +646,13 @@ actionSuspend(action_t * const pThis) DBGPRINTF("action '%s' suspended, earliest retry=%lld (now %lld), iNbrResRtry %d\n", pThis->pszName, (long long) pThis->ttResumeRtry, (long long) ttNow, pThis->iNbrResRtry); - ctime_r(&pThis->ttResumeRtry, timebuf); - timebuf[strlen(timebuf)-1] = '\0'; /* strip LF */ - errmsg.LogMsg(0, RS_RET_NOT_FOUND, LOG_WARNING, - "action '%s' suspended, next retry is %s", - pThis->pszName, timebuf); + if(bActionReportSuspension) { + ctime_r(&pThis->ttResumeRtry, timebuf); + timebuf[strlen(timebuf)-1] = '\0'; /* strip LF */ + errmsg.LogMsg(0, RS_RET_NOT_FOUND, LOG_WARNING, + "action '%s' suspended, next retry is %s", + pThis->pszName, timebuf); + } } @@ -692,8 +695,10 @@ actionDoRetry(action_t *pThis, int *pbShutdownImmediate) if((iRet == RS_RET_OK) && (!bTreatOKasSusp)) { DBGPRINTF("actionDoRetry: %s had success RDY again (iRet=%d)\n", pThis->pszName, iRet); - errmsg.LogMsg(0, RS_RET_OK, LOG_INFO, "action '%s' resumed", - pThis->pszName); + if(bActionReportSuspension) { + errmsg.LogMsg(0, RS_RET_OK, LOG_INFO, "action '%s' resumed", + pThis->pszName); + } actionSetState(pThis, ACT_STATE_RDY); } else if(iRet == RS_RET_SUSPENDED || bTreatOKasSusp) { /* max retries reached? */ diff --git a/action.h b/action.h index bbd63be1..20d7807b 100644 --- a/action.h +++ b/action.h @@ -28,11 +28,9 @@ #include "syslogd-types.h" #include "queue.h" -/* external data - this is to be removed when we change the action - * object interface (will happen some time..., at latest when the - * config file format is changed). -- rgerhards, 2008-01-28 - */ +/* external data */ extern int glbliActionResumeRetryCount; +extern int bActionReportSuspension; typedef enum { diff --git a/runtime/glbl.c b/runtime/glbl.c index e1d4e92d..3983a449 100644 --- a/runtime/glbl.c +++ b/runtime/glbl.c @@ -43,6 +43,7 @@ #include "prop.h" #include "atomic.h" #include "errmsg.h" +#include "action.h" #include "rainerscript.h" #include "net.h" @@ -105,6 +106,7 @@ static struct cnfparamdescr cnfparamdescr[] = { { "defaultnetstreamdriverkeyfile", eCmdHdlrString, 0 }, { "defaultnetstreamdriver", eCmdHdlrString, 0 }, { "maxmessagesize", eCmdHdlrSize, 0 }, + { "action.reportsuspension", eCmdHdlrBinary, 0 } }; static struct cnfparamblk paramblk = { CNFPARAMBLK_VERSION, @@ -693,6 +695,8 @@ glblDoneLoadCnf(void) } else if(!strcmp(paramblk.descr[i].name, "dropmsgswithmaliciousdnsptrrecords")) { bDropMalPTRMsgs = (int) cnfparamvals[i].val.d.n; + } else if(!strcmp(paramblk.descr[i].name, "action.reportsuspension")) { + bActionReportSuspension = (int) cnfparamvals[i].val.d.n; } else if(!strcmp(paramblk.descr[i].name, "maxmessagesize")) { iMaxLine = (int) cnfparamvals[i].val.d.n; } else { -- cgit v1.2.3