summaryrefslogtreecommitdiffstats
path: root/tcpsrv.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-12-20 18:35:37 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-12-20 18:35:37 +0100
commit409cd9496b08be6270c69e34374e94379ed0e4b9 (patch)
tree12d3bbfd1a28a4cc8a46c632b881d7a39da93261 /tcpsrv.c
parent00d2ac3d712fb037411e9856e8174e9d55b5bdbc (diff)
parent22b7ecfe76fefcbf7f911e8737d2c9fd55f60edd (diff)
downloadrsyslog-409cd9496b08be6270c69e34374e94379ed0e4b9.tar.gz
rsyslog-409cd9496b08be6270c69e34374e94379ed0e4b9.tar.xz
rsyslog-409cd9496b08be6270c69e34374e94379ed0e4b9.zip
Merge branch 'v5-devel'
Diffstat (limited to 'tcpsrv.c')
-rw-r--r--tcpsrv.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/tcpsrv.c b/tcpsrv.c
index fd591e3c..4d0c864f 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -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 */