summaryrefslogtreecommitdiffstats
path: root/plugins/imdiag
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-30 15:21:15 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-30 15:21:15 +0200
commite397c34d2a6c7c1e4c116fd2363cb173e32eb2a2 (patch)
tree878184db67626f2c6c0681afe046c5e250ed8906 /plugins/imdiag
parentde84a12f8a5f140c0f7b8e00f4cac92ef13cd866 (diff)
downloadrsyslog-e397c34d2a6c7c1e4c116fd2363cb173e32eb2a2.tar.gz
rsyslog-e397c34d2a6c7c1e4c116fd2363cb173e32eb2a2.tar.xz
rsyslog-e397c34d2a6c7c1e4c116fd2363cb173e32eb2a2.zip
finished transition to using inputName property
... plus some celanup and adding minor missing functionality (the rule debug info again tell the property name, not just number).
Diffstat (limited to 'plugins/imdiag')
-rw-r--r--plugins/imdiag/imdiag.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
index 4b004bc4..8d874a87 100644
--- a/plugins/imdiag/imdiag.c
+++ b/plugins/imdiag/imdiag.c
@@ -66,10 +66,12 @@ DEFobjCurrIf(net)
DEFobjCurrIf(netstrm)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(datetime)
+DEFobjCurrIf(prop)
/* Module static data */
static tcpsrv_t *pOurTcpsrv = NULL; /* our TCP server(listener) TODO: change for multiple instances */
static permittedPeers_t *pPermPeersRoot = NULL;
+static prop_t *pInputName = NULL; /* there is only one global inputName for all messages generated by this input */
/* config settings */
@@ -206,7 +208,7 @@ doInjectMsg(int iNum)
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &stTime, ttGenTime));
MsgSetRawMsg(pMsg, (char*) szMsg, ustrlen(szMsg));
- MsgSetInputNameStr(pMsg, UCHAR_CONSTANT("imdiag"), sizeof("imdiag")-1);
+ MsgSetInputName(pMsg, pInputName);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;
pMsg->bParseHOSTNAME = 1;
@@ -376,13 +378,19 @@ CODESTARTwillRun
/* first apply some config settings */
if(pOurTcpsrv == NULL)
ABORT_FINALIZE(RS_RET_NO_RUN);
+ /* we need to create the inputName property (only once during our lifetime) */
+ CHKiRet(prop.Construct(&pInputName));
+ CHKiRet(prop.SetString(pInputName, UCHAR_CONSTANT("imdiag"), sizeof("imdiag") - 1));
+ CHKiRet(prop.ConstructFinalize(pInputName));
+
finalize_it:
ENDwillRun
BEGINafterRun
CODESTARTafterRun
- /* do cleanup here */
+ if(pInputName != NULL)
+ prop.Destruct(&pInputName);
ENDafterRun
@@ -402,6 +410,7 @@ CODESTARTmodExit
objRelease(tcpsrv, LM_TCPSRV_FILENAME);
objRelease(errmsg, CORE_COMPONENT);
objRelease(datetime, CORE_COMPONENT);
+ objRelease(prop, CORE_COMPONENT);
ENDmodExit
@@ -439,6 +448,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(tcpsrv, LM_TCPSRV_FILENAME));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(datetime, CORE_COMPONENT));
+ CHKiRet(objUse(prop, CORE_COMPONENT));
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("imdiagserverrun"), 0, eCmdHdlrGetWord,