summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-02-02 15:28:24 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2009-02-02 15:28:24 +0100
commit6ce4a9d605e62b32ed62b5d6e498de5202565cee (patch)
tree2e3305051ead599c1e73ed25c27d65830afe58e6
parentec2019abe255949d5adcafc8f81cb949b45885e3 (diff)
downloadrsyslog-6ce4a9d605e62b32ed62b5d6e498de5202565cee.tar.gz
rsyslog-6ce4a9d605e62b32ed62b5d6e498de5202565cee.tar.xz
rsyslog-6ce4a9d605e62b32ed62b5d6e498de5202565cee.zip
added new config directive $RepeatedMsgContainsOriginalMsg
so that the "last message repeated n times" messages, if generated, may have an alternate format that contains the message that is being repeated. Note that this is on an action-by-action basis.
-rw-r--r--ChangeLog5
-rw-r--r--action.c19
-rw-r--r--action.h3
-rw-r--r--doc/rsyslog_conf_global.html8
4 files changed, 25 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 5056f68d..acd3df4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
---------------------------------------------------------------------------
+Version 4.1.5 [DEVEL] (rgerhards), 2009-02-??
+- added new config directive $RepeatedMsgContainsOriginalMsg so that the
+ "last message repeated n times" messages, if generated, may
+ have an alternate format that contains the message that is being repeated
+---------------------------------------------------------------------------
Version 4.1.3 [DEVEL] (rgerhards), 2008-12-17
- added $InputTCPServerAddtlFrameDelimiter config directive, which
enables to specify an additional, non-standard message delimiter
diff --git a/action.c b/action.c
index c95c0def..a41f976c 100644
--- a/action.c
+++ b/action.c
@@ -58,6 +58,7 @@ static int iActExecEveryNthOccur = 0; /* execute action every n-th occurence (0,
static time_t iActExecEveryNthOccurTO = 0; /* timeout for n-occurence setting (in seconds, 0=never) */
static int glbliActionResumeInterval = 30;
int glbliActionResumeRetryCount = 0; /* how often should suspended actions be retried? */
+static int bActionRepMsgHasMsg = 0; /* last messsage repeated... has msg fragment in it */
/* main message queue and its configuration parameters */
static queueType_t ActionQueType = QUEUETYPE_DIRECT; /* type of the main message queue above */
@@ -621,15 +622,7 @@ actionWriteToAction(action_t *pAction)
*/
if(pAction->f_prevcount > 1) {
msg_t *pMsg;
-#if 0 /* old */
- uchar szRepMsg[64];
- snprintf((char*)szRepMsg, sizeof(szRepMsg), "last message repeated %d times",
- pAction->f_prevcount);
-#else
uchar szRepMsg[1024];
- snprintf((char*)szRepMsg, sizeof(szRepMsg), "message repeated %d times: [%.800s]",
- pAction->f_prevcount, getMSG(pAction->f_pMsg));
-#endif
if((pMsg = MsgDup(pAction->f_pMsg)) == NULL) {
/* it failed - nothing we can do against it... */
@@ -637,6 +630,14 @@ actionWriteToAction(action_t *pAction)
ABORT_FINALIZE(RS_RET_ERR);
}
+ if(pAction->bRepMsgHasMsg == 0) { /* old format repeat message? */
+ snprintf((char*)szRepMsg, sizeof(szRepMsg), "last message repeated %d times",
+ pAction->f_prevcount);
+ } else {
+ snprintf((char*)szRepMsg, sizeof(szRepMsg), "message repeated %d times: [%.800s]",
+ pAction->f_prevcount, getMSG(pAction->f_pMsg));
+ }
+
/* We now need to update the other message properties.
* ... RAWMSG is a problem ... Please note that digital
* signatures inside the message are also invalidated.
@@ -823,6 +824,7 @@ actionAddCfSysLineHdrl(void)
CHKiRet(regCfSysLineHdlr((uchar *)"actionqueuedequeuetimeend", 0, eCmdHdlrInt, NULL, &iActionQueueDeqtWinToHr, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlyeverynthtime", 0, eCmdHdlrInt, NULL, &iActExecEveryNthOccur, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionexeconlyeverynthtimetimeout", 0, eCmdHdlrInt, NULL, &iActExecEveryNthOccurTO, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"repeatedmsgcontainsoriginalmsg", 0, eCmdHdlrBinary, NULL, &bActionRepMsgHasMsg, NULL));
finalize_it:
RETiRet;
@@ -856,6 +858,7 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringReques
pAction->iSecsExecOnceInterval = iActExecOnceInterval;
pAction->iExecEveryNthOccur = iActExecEveryNthOccur;
pAction->iExecEveryNthOccurTO = iActExecEveryNthOccurTO;
+ pAction->bRepMsgHasMsg = bActionRepMsgHasMsg;
iActExecEveryNthOccur = 0; /* auto-reset */
iActExecEveryNthOccurTO = 0; /* auto-reset */
diff --git a/action.h b/action.h
index 8d9d5102..e35e634c 100644
--- a/action.h
+++ b/action.h
@@ -57,7 +57,8 @@ struct action_s {
time_t tLastOccur; /* time last occurence was seen (for timing them out) */
struct modInfo_s *pMod;/* pointer to output module handling this selector */
void *pModData; /* pointer to module data - content is module-specific */
- int f_ReduceRepeated;/* reduce repeated lines 0 - no, 1 - yes */
+ short bRepMsgHasMsg; /* "message repeated..." has msg fragment in it (0-no, 1-yes) */
+ short f_ReduceRepeated;/* reduce repeated lines 0 - no, 1 - yes */
int f_prevcount; /* repetition cnt of prevline */
int f_repeatcount; /* number of "repeated" msgs */
int iNumTpls; /* number of array entries for template element below */
diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
index 6e03e571..b0c1e400 100644
--- a/doc/rsyslog_conf_global.html
+++ b/doc/rsyslog_conf_global.html
@@ -181,6 +181,12 @@ supported in order to be compliant to the upcoming new syslog RFC series.
</li>
<li><a href="rsconf1_moddir.html">$ModDir</a></li>
<li><a href="rsconf1_modload.html">$ModLoad</a></li>
+<li><b>$RepeatedMsgContainsOriginalMsg</b> [on/<b>off</b>] - "last message repeated n times" messages, if generated,
+have a different format that contains the message that is being repeated.
+Note that only the first "n" characters are included, with n to be at least 80 characters, most
+probably more (this may change from version to version, thus no specific limit is given). The bottom
+line is that n is large enough to get a good idea which message was repeated but it is not necessarily
+large enough for the whole message. (Introduced with 4.1.5). Once set, it affects all following actions.</li>
<li><a href="rsconf1_repeatedmsgreduction.html">$RepeatedMsgReduction</a></li>
<li><a href="rsconf1_resetconfigvariables.html">$ResetConfigVariables</a></li>
<li><b>$OptimizeForUniprocessor</b> [on/<b>off</b>] - turns on optimizatons which lead to better
@@ -226,7 +232,7 @@ point of view, "1,,0.0.,.,0" also has the value 1000. </p>
[<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
<p><font size="2">This documentation is part of the
<a href="http://www.rsyslog.com/">rsyslog</a> project.<br>
-Copyright &copy; 2008 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
+Copyright &copy; 2008, 2009 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
<a href="http://www.adiscon.com/">Adiscon</a>. Released under the GNU GPL
version 2 or higher.</font></p>
</body>