diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-12-20 18:35:37 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-12-20 18:35:37 +0100 |
commit | 409cd9496b08be6270c69e34374e94379ed0e4b9 (patch) | |
tree | 12d3bbfd1a28a4cc8a46c632b881d7a39da93261 | |
parent | 00d2ac3d712fb037411e9856e8174e9d55b5bdbc (diff) | |
parent | 22b7ecfe76fefcbf7f911e8737d2c9fd55f60edd (diff) | |
download | rsyslog-409cd9496b08be6270c69e34374e94379ed0e4b9.tar.gz rsyslog-409cd9496b08be6270c69e34374e94379ed0e4b9.tar.xz rsyslog-409cd9496b08be6270c69e34374e94379ed0e4b9.zip |
Merge branch 'v5-devel'
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | plugins/imuxsock/imuxsock.c | 18 | ||||
-rw-r--r-- | runtime/statsobj.c | 2 | ||||
-rw-r--r-- | tcps_sess.c | 1 | ||||
-rw-r--r-- | tcpsrv.c | 15 | ||||
-rw-r--r-- | tcpsrv.h | 3 |
6 files changed, 34 insertions, 10 deletions
@@ -430,9 +430,14 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-06-08 closes: http://bugzilla.adiscon.com/show_bug.cgi?id=236 --------------------------------------------------------------------------- Version 5.8.7 [V5-stable] 2011-??-?? +- bugfix: imuxsock did truncate part of received message if it did not + contain a proper date. The truncation occured because we removed that + part of the messages that was expected to be the date. + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=295 - bugfix: potential abort after reading invalid X.509 certificate closes: http://bugzilla.adiscon.com/show_bug.cgi?id=290 Thanks to Tomas Heinrich for the patch +- bugfix: stats counter were not properly initialized on creation --------------------------------------------------------------------------- Version 5.8.6 [V5-stable] 2011-10-21 - bugfix: missing whitespace after property-based filter was not detected diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index fa36a962..c5d6b1f1 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -721,6 +721,7 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim uchar msgbuf[8192]; uchar *pmsgbuf; int toffs; /* offset for trusted properties */ + struct syslogTime dummyTS; DEFiRet; /* TODO: handle format errors?? */ @@ -815,6 +816,10 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim if(ts == NULL) { if((pLstn->flags & IGNDATE)) { + /* in this case, we still need to find out if we have a valid + * datestamp or not .. and advance the parse pointer accordingly. + */ + datetime.ParseTIMESTAMP3164(&dummyTS, &parse, &lenMsg); parse += 16; /* just skip timestamp */ lenMsg -= 16; } else { @@ -823,15 +828,10 @@ SubmitMsg(uchar *pRcv, int lenRcv, lstn_t *pLstn, struct ucred *cred, struct tim } } } else { /* if we pulled the time from the system, we need to update the message text */ - if(lenMsg >= 16) { - /* RFC3164 timestamp is 16 bytes long, so assuming a valid stamp, - * we can fixup the message. If the part is smaller, the stamp can - * not be valid and we do not touch the message. Note that there may - * be some scenarios where the message is larg enough but the stamp is - * still invalid. In those cases we will destruct part of the message, - * but this case is considered extremely unlikely and thus not handled - * specifically. -- rgerhards, 2011-06-20 - */ + uchar *tmpParse = parse; /* just to check correctness of TS */ + if(datetime.ParseTIMESTAMP3164(&dummyTS, &tmpParse, &lenMsg) == RS_RET_OK) { + /* We modify the message only if it contained a valid timestamp, + * otherwise we do not touch it at all. */ datetime.formatTimestamp3164(&st, (char*)parse, 0); parse[15] = ' '; /* re-write \0 from fromatTimestamp3164 by SP */ /* update "counters" to reflect processed timestamp */ diff --git a/runtime/statsobj.c b/runtime/statsobj.c index d1213a34..c165c70e 100644 --- a/runtime/statsobj.c +++ b/runtime/statsobj.c @@ -153,9 +153,11 @@ addCounter(statsobj_t *pThis, uchar *ctrName, statsCtrType_t ctrType, void *pCtr switch(ctrType) { case ctrType_IntCtr: ctr->val.pIntCtr = (intctr_t*) pCtr; + *(ctr->val.pIntCtr) = 0; break; case ctrType_Int: ctr->val.pInt = (int*) pCtr; + *(ctr->val.pInt) = 0; break; } addCtrToList(pThis, ctr); diff --git a/tcps_sess.c b/tcps_sess.c index 3b03f872..682b0552 100644 --- a/tcps_sess.c +++ b/tcps_sess.c @@ -261,6 +261,7 @@ defaultDoSubmitMessage(tcps_sess_t *pThis, struct syslogTime *stTime, time_t ttG CHKiRet(MsgSetRcvFromIP(pMsg, pThis->fromHostIP)); MsgSetRuleset(pMsg, pThis->pLstnInfo->pRuleset); + STATSCOUNTER_INC(pThis->pLstnInfo->ctrSubmit, pThis->pLstnInfo->mutCtrSubmit); if(pMultiSub == NULL) { CHKiRet(submitMsg(pMsg)); } else { @@ -36,8 +36,8 @@ * * A copy of the GPL can be found in the file "COPYING" in this distribution. */ - #include "config.h" +#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> @@ -92,6 +92,7 @@ DEFobjCurrIf(netstrm) DEFobjCurrIf(nssel) DEFobjCurrIf(nspoll) DEFobjCurrIf(prop) +DEFobjCurrIf(statsobj) /* The following structure controls the worker threads. Global data is @@ -118,6 +119,7 @@ static inline rsRetVal addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort) { tcpLstnPortList_t *pEntry; + uchar statname[64]; DEFiRet; ISOBJ_TYPE_assert(pThis, tcpsrv); @@ -137,6 +139,15 @@ addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort) pEntry->pNext = pThis->pLstnPorts; pThis->pLstnPorts = pEntry; + /* support statistics gathering */ + CHKiRet(statsobj.Construct(&(pEntry->stats))); + snprintf((char*)statname, sizeof(statname), "%s(%s)", pThis->pszInputName, pszPort); + statname[sizeof(statname)-1] = '\0'; /* just to be on the save side... */ + CHKiRet(statsobj.SetName(pEntry->stats, statname)); + CHKiRet(statsobj.AddCounter(pEntry->stats, UCHAR_CONSTANT("submitted"), + ctrType_IntCtr, &(pEntry->ctrSubmit))); + CHKiRet(statsobj.ConstructFinalize(pEntry->stats)); + finalize_it: RETiRet; } @@ -1254,6 +1265,7 @@ CODESTARTObjClassExit(tcpsrv) objRelease(tcps_sess, DONT_LOAD_LIB); objRelease(conf, CORE_COMPONENT); objRelease(prop, CORE_COMPONENT); + objRelease(statsobj, CORE_COMPONENT); objRelease(ruleset, CORE_COMPONENT); objRelease(glbl, CORE_COMPONENT); objRelease(errmsg, CORE_COMPONENT); @@ -1280,6 +1292,7 @@ BEGINObjClassInit(tcpsrv, 1, OBJ_IS_LOADABLE_MODULE) /* class, version - CHANGE CHKiRet(objUse(conf, CORE_COMPONENT)); CHKiRet(objUse(glbl, CORE_COMPONENT)); CHKiRet(objUse(ruleset, CORE_COMPONENT)); + CHKiRet(objUse(statsobj, CORE_COMPONENT)); CHKiRet(objUse(prop, CORE_COMPONENT)); /* set our own handlers */ @@ -25,6 +25,7 @@ #include "obj.h" #include "prop.h" #include "tcps_sess.h" +#include "statsobj.h" /* support for framing anomalies */ typedef enum ETCPsyslogFramingAnomaly { @@ -40,6 +41,8 @@ struct tcpLstnPortList_s { prop_t *pInputName; tcpsrv_t *pSrv; /**< pointer to higher-level server instance */ ruleset_t *pRuleset; /**< associated ruleset */ + statsobj_t *stats; /**< associated stats object */ + STATSCOUNTER_DEF(ctrSubmit, mutCtrSubmit) tcpLstnPortList_t *pNext; /**< next port or NULL */ }; |