summaryrefslogtreecommitdiffstats
path: root/runtime/msg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-03-15 17:25:26 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2012-03-15 17:25:26 +0100
commit66ab2a70e5bcc9637dfec89c6134abe10b96dde8 (patch)
tree20a8361a2167e760d689271b00ac77afa0e66baa /runtime/msg.c
parent32df7bf254f8e82f4857d9d0f5eeb49d678d08c8 (diff)
downloadrsyslog-66ab2a70e5bcc9637dfec89c6134abe10b96dde8.tar.gz
rsyslog-66ab2a70e5bcc9637dfec89c6134abe10b96dde8.tar.xz
rsyslog-66ab2a70e5bcc9637dfec89c6134abe10b96dde8.zip
added message property parsesuccess to indicate status of higher level parser run
added message property parsesuccess to indicate if the last run higher-level parser could successfully parse the message or not (see property replacer html doc for details)
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c
index 541409e4..8f5fb080 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -535,6 +535,8 @@ propNameStrToID(uchar *pName, propid_t *pPropID)
*pPropID = PROP_PROCID;
} else if(!strcmp((char*) pName, "msgid")) {
*pPropID = PROP_MSGID;
+ } else if(!strcmp((char*) pName, "parsesuccess")) {
+ *pPropID = PROP_PARSESUCCESS;
/* here start system properties (those, that do not relate to the message itself */
} else if(!strcmp((char*) pName, "$now")) {
*pPropID = PROP_SYS_NOW;
@@ -632,6 +634,8 @@ uchar *propIDToName(propid_t propID)
return UCHAR_CONSTANT("procid");
case PROP_MSGID:
return UCHAR_CONSTANT("msgid");
+ case PROP_PARSESUCCESS:
+ return UCHAR_CONSTANT("parsesuccess");
case PROP_SYS_NOW:
return UCHAR_CONSTANT("$NOW");
case PROP_SYS_YEAR:
@@ -694,6 +698,7 @@ static inline rsRetVal msgBaseConstruct(msg_t **ppThis)
pM->flowCtlType = 0;
pM->bDoLock = 0;
pM->bAlreadyFreed = 0;
+ pM->bParseSuccess = 0;
pM->iRefCount = 1;
pM->iSeverity = -1;
pM->iFacility = -1;
@@ -1632,6 +1637,15 @@ finalize_it:
}
+/* Return state of last parser. If it had success, "OK" is returned, else
+ * "FAIL". All from the constant pool.
+ */
+static inline char *getParseSuccess(msg_t *pM)
+{
+ return (pM->bParseSuccess) ? "OK" : "FAIL";
+}
+
+
/* al, 2011-07-26: LockMsg to avoid race conditions
*/
static inline char *getMSGID(msg_t *pM)
@@ -1647,6 +1661,14 @@ static inline char *getMSGID(msg_t *pM)
}
}
+/* rgerhards 2012-03-15: set parser success (an integer, acutally bool)
+ */
+void MsgSetParseSuccess(msg_t *pMsg, int bSuccess)
+{
+ assert(pMsg != NULL);
+ pMsg->bParseSuccess = bSuccess;
+}
+
/* rgerhards 2009-06-12: set associated ruleset
*/
void MsgSetRuleset(msg_t *pMsg, ruleset_t *pRuleset)
@@ -2453,6 +2475,9 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
case PROP_MSGID:
pRes = (uchar*)getMSGID(pMsg);
break;
+ case PROP_PARSESUCCESS:
+ pRes = (uchar*)getParseSuccess(pMsg);
+ break;
case PROP_SYS_NOW:
if((pRes = getNOW(NOW_NOW)) == NULL) {
RET_OUT_OF_MEMORY;