summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/imuxsock/imuxsock.c31
-rw-r--r--runtime/ratelimit.c8
2 files changed, 6 insertions, 33 deletions
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index 3421863d..6aa2b1e8 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -763,28 +763,6 @@ copyescaped(uchar *dstbuf, uchar *inbuf, int inlen)
}
-#if 0
-/* Creates new field to be added to event
- * used for SystemLogParseTrusted parsing
- */
-struct ee_field *
-createNewField(char *fieldname, char *value, int lenValue) {
- es_str_t *newStr;
- struct ee_value *newVal;
- struct ee_field *newField;
-
- newStr = es_newStrFromBuf(value, (es_size_t) lenValue);
-
- newVal = ee_newValue(ctxee);
- ee_setStrValue(newVal, newStr);
-
- newField = ee_newFieldFromNV(ctxee, fieldname, newVal);
-
- return newField;
-}
-#endif
-
-
/* submit received message to the queue engine
* We now parse the message according to expected format so that we
* can also mangle it if necessary.
@@ -811,14 +789,12 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim
int toffs; /* offset for trusted properties */
struct syslogTime dummyTS;
struct json_object *json = NULL, *jval;
- msg_t *repMsg;
DEFiRet;
#warning experimental code needs to be made production-ready!
/* we need to decide how many ratelimiters we use --> hashtable
also remove current homegrown ratelimiting functionality and
replace it with the new one.
*/
-rsRetVal localRet;
static ratelimit_t *ratelimit = NULL;
if(ratelimit == NULL)
ratelimitNew(&ratelimit);
@@ -993,12 +969,7 @@ if(ratelimit == NULL)
MsgSetRcvFrom(pMsg, pLstn->hostName == NULL ? glbl.GetLocalHostNameProp() : pLstn->hostName);
CHKiRet(MsgSetRcvFromIP(pMsg, pLocalHostIP));
- localRet = ratelimitMsg(ratelimit, pMsg, &repMsg);
- if(repMsg != NULL)
- CHKiRet(submitMsg(repMsg));
- if(localRet == RS_RET_OK)
- CHKiRet(submitMsg(pMsg));
-
+ ratelimitAddMsg(ratelimit, NULL, pMsg);
STATSCOUNTER_INC(ctrSubmit, mutCtrSubmit);
finalize_it:
RETiRet;
diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c
index 2df5f78a..d3d32b58 100644
--- a/runtime/ratelimit.c
+++ b/runtime/ratelimit.c
@@ -147,9 +147,11 @@ ratelimitAddMsg(ratelimit_t *ratelimit, multi_submit_t *pMultiSub, msg_t *pMsg)
DEFiRet;
if(pMultiSub == NULL) {
-dbgprintf("DDDDD: multiSubmitAddMsg, not checking ratelimiter for single submit!\n");
-#warning missing multisub Implementation?
- CHKiRet(submitMsg(pMsg));
+ localRet = ratelimitMsg(ratelimit, pMsg, &repMsg);
+ if(repMsg != NULL)
+ CHKiRet(submitMsg2(repMsg));
+ if(localRet == RS_RET_OK)
+ CHKiRet(submitMsg2(pMsg));
} else {
localRet = ratelimitMsg(ratelimit, pMsg, &repMsg);
if(repMsg != NULL) {