From f2f85fcf446dcfb8ca9a21dff6a292bf7f68607f Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 27 Sep 2012 18:38:53 +0200
Subject: fix whitespace issue
---
plugins/imfile/imfile.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 462a5e78..453b6b05 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -562,7 +562,6 @@ finalize_it:
ENDsetModCnf
-
BEGINendCnfLoad
CODESTARTendCnfLoad
if(!loadModConf->configSetViaV2Method) {
--
cgit v1.2.3
From 5347e87dca36d4c125832b2ef52f16c6d3a9fb83 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 27 Sep 2012 18:47:51 +0200
Subject: imptcp: implement support for module() parameters
---
plugins/imptcp/imptcp.c | 77 ++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 70 insertions(+), 7 deletions(-)
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index 9992ee20..a13fd990 100644
--- a/plugins/imptcp/imptcp.c
+++ b/plugins/imptcp/imptcp.c
@@ -90,6 +90,8 @@ DEFobjCurrIf(statsobj)
/* forward references */
static void * wrkr(void *myself);
+#define DFLT_wrkrMax 2
+
/* config settings */
typedef struct configSettings_s {
int bKeepAlive; /* support keep-alive packets */
@@ -127,11 +129,22 @@ struct modConfData_s {
rsconf_t *pConf; /* our overall config object */
instanceConf_t *root, *tail;
int wrkrMax;
+ sbool configSetViaV2Method;
};
static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */
static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current load process */
+/* module-global parameters */
+static struct cnfparamdescr modpdescr[] = {
+ { "threads", eCmdHdlrPositiveInt, 0 }
+};
+static struct cnfparamblk modpblk =
+ { CNFPARAMBLK_VERSION,
+ sizeof(modpdescr)/sizeof(struct cnfparamdescr),
+ modpdescr
+ };
+
/* input instance parameters */
static struct cnfparamdescr inppdescr[] = {
{ "port", eCmdHdlrString, CNFPARAM_REQUIRED }, /* legacy: InputTCPServerRun */
@@ -153,6 +166,8 @@ static struct cnfparamblk inppblk =
};
#include "im-helper.h" /* must be included AFTER the type definitions! */
+static int bLegacyCnfModGlobalsPermitted;/* are legacy module-global config parameters permitted? */
+
/* data elements describing our running config */
typedef struct ptcpsrv_s ptcpsrv_t;
typedef struct ptcplstn_s ptcplstn_t;
@@ -832,7 +847,7 @@ static inline void
initConfigSettings(void)
{
cs.bEmitMsgOnClose = 0;
- cs.wrkrMax = 2;
+ cs.wrkrMax = DFLT_wrkrMax;
cs.bSuppOctetFram = 1;
cs.iAddtlFrameDelim = TCPSRV_NO_ADDTL_DELIMITER;
cs.pszInputName = NULL;
@@ -1152,6 +1167,7 @@ startWorkerPool(void)
wrkrRunning = 0;
if(runModConf->wrkrMax > 16)
runModConf->wrkrMax = 16; /* TODO: make dynamic? */
+ DBGPRINTF("imptcp: starting worker pool, %d workers\n", runModConf->wrkrMax);
pthread_mutex_init(&wrkrMut, NULL);
pthread_cond_init(&wrkrIdle, NULL);
for(i = 0 ; i < runModConf->wrkrMax ; ++i) {
@@ -1170,6 +1186,7 @@ static inline void
stopWorkerPool(void)
{
int i;
+ DBGPRINTF("imptcp: stoping worker pool\n");
for(i = 0 ; i < runModConf->wrkrMax ; ++i) {
pthread_cond_signal(&wrkrInfo[i].run); /* awake wrkr if not running */
pthread_join(wrkrInfo[i].tid, NULL);
@@ -1178,7 +1195,6 @@ stopWorkerPool(void)
}
pthread_cond_destroy(&wrkrIdle);
pthread_mutex_destroy(&wrkrMut);
-
}
@@ -1455,15 +1471,60 @@ BEGINbeginCnfLoad
CODESTARTbeginCnfLoad
loadModConf = pModConf;
pModConf->pConf = pConf;
+ /* init our settings */
+ loadModConf->wrkrMax = DFLT_wrkrMax;
+ loadModConf->configSetViaV2Method = 0;
+ bLegacyCnfModGlobalsPermitted = 1;
/* init legacy config vars */
initConfigSettings();
ENDbeginCnfLoad
+BEGINsetModCnf
+ struct cnfparamvals *pvals = NULL;
+ int i;
+CODESTARTsetModCnf
+ pvals = nvlstGetParams(lst, &modpblk, NULL);
+ if(pvals == NULL) {
+ errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS, "imptcp: error processing module "
+ "config parameters [module(...)]");
+ ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
+ }
+
+ if(Debug) {
+ dbgprintf("module (global) param blk for imptcp:\n");
+ cnfparamsPrint(&modpblk, pvals);
+ }
+
+ for(i = 0 ; i < modpblk.nParams ; ++i) {
+ if(!pvals[i].bUsed)
+ continue;
+ if(!strcmp(modpblk.descr[i].name, "threads")) {
+ loadModConf->wrkrMax = (int) pvals[i].val.d.n;
+ } else {
+ dbgprintf("imptcp: program error, non-handled "
+ "param '%s' in beginCnfLoad\n", modpblk.descr[i].name);
+ }
+ }
+
+ /* remove all of our legacy handlers, as they can not used in addition
+ * the the new-style config method.
+ */
+ bLegacyCnfModGlobalsPermitted = 0;
+ loadModConf->configSetViaV2Method = 1;
+
+finalize_it:
+ if(pvals != NULL)
+ cnfparamvalsDestruct(pvals, &modpblk);
+ENDsetModCnf
+
+
BEGINendCnfLoad
CODESTARTendCnfLoad
- /* persist module-specific settings from legacy config system */
- loadModConf->wrkrMax = cs.wrkrMax;
+ if(!loadModConf->configSetViaV2Method) {
+ /* persist module-specific settings from legacy config system */
+ loadModConf->wrkrMax = cs.wrkrMax;
+ }
loadModConf = NULL; /* done loading */
/* free legacy config vars */
@@ -1647,7 +1708,7 @@ static rsRetVal
resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
cs.bEmitMsgOnClose = 0;
- cs.wrkrMax = 2;
+ cs.wrkrMax = DFLT_wrkrMax;
cs.bKeepAlive = 0;
cs.iKeepAliveProbes = 0;
cs.iKeepAliveTime = 0;
@@ -1673,6 +1734,7 @@ BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_IMOD_QUERIES
CODEqueryEtryPt_STD_CONF2_QUERIES
+CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES
CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES
CODEqueryEtryPt_STD_CONF2_IMOD_QUERIES
CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES
@@ -1716,14 +1778,15 @@ CODEmodInit_QueryRegCFSLineHdlr
eCmdHdlrBinary, NULL, &cs.bEmitMsgOnClose, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputptcpserveraddtlframedelimiter"), 0, eCmdHdlrInt,
NULL, &cs.iAddtlFrameDelim, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputptcpserverhelperthreads"), 0, eCmdHdlrInt,
- NULL, &cs.wrkrMax, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputptcpserverinputname"), 0,
eCmdHdlrGetWord, NULL, &cs.pszInputName, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputptcpserverlistenip"), 0,
eCmdHdlrGetWord, NULL, &cs.lstnIP, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputptcpserverbindruleset"), 0,
eCmdHdlrGetWord, NULL, &cs.pszBindRuleset, STD_LOADABLE_MODULE_ID));
+ /* module-global parameters */
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputptcpserverhelperthreads"), 0, eCmdHdlrInt,
+ NULL, &cs.wrkrMax, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("resetconfigvariables"), 1, eCmdHdlrCustomHandler,
resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
--
cgit v1.2.3
From 43da91636a5d8f60c21f1795d25fb0755e356d9f Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Fri, 28 Sep 2012 08:09:47 +0200
Subject: imtcp: implement support for module() parameters
---
plugins/imtcp/imtcp.c | 173 +++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 135 insertions(+), 38 deletions(-)
diff --git a/plugins/imtcp/imtcp.c b/plugins/imtcp/imtcp.c
index a00d4ebe..3ad03615 100644
--- a/plugins/imtcp/imtcp.c
+++ b/plugins/imtcp/imtcp.c
@@ -123,11 +123,31 @@ struct modConfData_s {
sbool bKeepAlive;
sbool bEmitMsgOnClose; /* emit an informational message on close by remote peer */
uchar *pszStrmDrvrAuthMode; /* authentication mode to use */
+ sbool configSetViaV2Method;
};
static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */
static modConfData_t *runModConf = NULL;/* modConf ptr to use for the current load process */
+/* module-global parameters */
+static struct cnfparamdescr modpdescr[] = {
+ { "flowcontrol", eCmdHdlrBinary, 0 },
+ { "disablelfdelimiter", eCmdHdlrBinary, 0 },
+ { "octetcountedframing", eCmdHdlrBinary, 0 },
+ { "notifyonconnectionclose", eCmdHdlrBinary, 0 },
+ { "addtlframedelimiter", eCmdHdlrPositiveInt, 0 },
+ { "maxsessions", eCmdHdlrPositiveInt, 0 },
+ { "maxlistners", eCmdHdlrPositiveInt, 0 },
+ { "streamdriver.mode", eCmdHdlrPositiveInt, 0 },
+ { "streamdriver.authmode", eCmdHdlrString, 0 },
+ { "keepalive", eCmdHdlrBinary, 0 }
+};
+static struct cnfparamblk modpblk =
+ { CNFPARAMBLK_VERSION,
+ sizeof(modpdescr)/sizeof(struct cnfparamdescr),
+ modpdescr
+ };
+
/* input instance parameters */
static struct cnfparamdescr inppdescr[] = {
{ "port", eCmdHdlrString, CNFPARAM_REQUIRED }, /* legacy: InputTCPServerRun */
@@ -143,6 +163,8 @@ static struct cnfparamblk inppblk =
#include "im-helper.h" /* must be included AFTER the type definitions! */
+static int bLegacyCnfModGlobalsPermitted;/* are legacy module-global config parameters permitted? */
+
/* callbacks */
/* this shall go into a specific ACL module! */
static int
@@ -242,8 +264,6 @@ finalize_it:
}
-
-
/* This function is called when a new listener instace shall be added to
* the current config object via the legacy config system. It just shuffles
* all parameters to the listener in-memory instance.
@@ -369,30 +389,103 @@ BEGINbeginCnfLoad
CODESTARTbeginCnfLoad
loadModConf = pModConf;
pModConf->pConf = pConf;
+ /* init our settings */
+ loadModConf->iTCPSessMax = 200;
+ loadModConf->iTCPLstnMax = 20;
+ loadModConf->bSuppOctetFram = 1;
+ loadModConf->iStrmDrvrMode = 0;
+ loadModConf->bUseFlowControl = 0;
+ loadModConf->bKeepAlive = 0;
+ loadModConf->bEmitMsgOnClose = 0;
+ loadModConf->iAddtlFrameDelim = TCPSRV_NO_ADDTL_DELIMITER;
+ loadModConf->bDisableLFDelim = 0;
+ loadModConf->pszStrmDrvrAuthMode = NULL;
+ loadModConf->configSetViaV2Method = 0;
+ bLegacyCnfModGlobalsPermitted = 1;
/* init legacy config variables */
cs.pszStrmDrvrAuthMode = NULL;
resetConfigVariables(NULL, NULL); /* dummy parameters just to fulfill interface def */
ENDbeginCnfLoad
+BEGINsetModCnf
+ struct cnfparamvals *pvals = NULL;
+ int i;
+CODESTARTsetModCnf
+ pvals = nvlstGetParams(lst, &modpblk, NULL);
+ if(pvals == NULL) {
+ errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS, "imtcp: error processing module "
+ "config parameters [module(...)]");
+ ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
+ }
+
+ if(Debug) {
+ dbgprintf("module (global) param blk for imtcp:\n");
+ cnfparamsPrint(&modpblk, pvals);
+ }
+
+ for(i = 0 ; i < modpblk.nParams ; ++i) {
+ if(!pvals[i].bUsed)
+ continue;
+ if(!strcmp(modpblk.descr[i].name, "flowcontrol")) {
+ loadModConf->bUseFlowControl = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "disablelfdelimiter")) {
+ loadModConf->bDisableLFDelim = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "octetcountedframing")) {
+ loadModConf->bSuppOctetFram = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "notifyonconnectionclose")) {
+ loadModConf->bEmitMsgOnClose = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "addtlframedelimiter")) {
+ loadModConf->iAddtlFrameDelim = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "maxsessions")) {
+ loadModConf->iTCPSessMax = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "maxlistners")) {
+ loadModConf->iTCPLstnMax = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "keepalive")) {
+ loadModConf->bKeepAlive = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "streamdriver.mode")) {
+ loadModConf->iStrmDrvrMode = (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "streamdriver.mode")) {
+ loadModConf->pszStrmDrvrAuthMode = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
+ } else {
+ dbgprintf("imtcp: program error, non-handled "
+ "param '%s' in beginCnfLoad\n", modpblk.descr[i].name);
+ }
+ }
+
+ /* remove all of our legacy handlers, as they can not used in addition
+ * the the new-style config method.
+ */
+ bLegacyCnfModGlobalsPermitted = 0;
+ loadModConf->configSetViaV2Method = 1;
+
+finalize_it:
+ if(pvals != NULL)
+ cnfparamvalsDestruct(pvals, &modpblk);
+ENDsetModCnf
+
+
BEGINendCnfLoad
CODESTARTendCnfLoad
- /* persist module-specific settings from legacy config system */
- pModConf->iTCPSessMax = cs.iTCPSessMax;
- pModConf->iTCPLstnMax = cs.iTCPLstnMax;
- pModConf->iStrmDrvrMode = cs.iStrmDrvrMode;
- pModConf->bEmitMsgOnClose = cs.bEmitMsgOnClose;
- pModConf->bSuppOctetFram = cs.bSuppOctetFram;
- pModConf->iAddtlFrameDelim = cs.iAddtlFrameDelim;
- pModConf->bDisableLFDelim = cs.bDisableLFDelim;
- pModConf->bUseFlowControl = cs.bUseFlowControl;
- pModConf->bKeepAlive = cs.bKeepAlive;
- if((cs.pszStrmDrvrAuthMode == NULL) || (cs.pszStrmDrvrAuthMode[0] == '\0')) {
- loadModConf->pszStrmDrvrAuthMode = NULL;
- free(cs.pszStrmDrvrAuthMode);
- } else {
- loadModConf->pszStrmDrvrAuthMode = cs.pszStrmDrvrAuthMode;
+ if(!loadModConf->configSetViaV2Method) {
+ /* persist module-specific settings from legacy config system */
+ pModConf->iTCPSessMax = cs.iTCPSessMax;
+ pModConf->iTCPLstnMax = cs.iTCPLstnMax;
+ pModConf->iStrmDrvrMode = cs.iStrmDrvrMode;
+ pModConf->bEmitMsgOnClose = cs.bEmitMsgOnClose;
+ pModConf->bSuppOctetFram = cs.bSuppOctetFram;
+ pModConf->iAddtlFrameDelim = cs.iAddtlFrameDelim;
+ pModConf->bDisableLFDelim = cs.bDisableLFDelim;
+ pModConf->bUseFlowControl = cs.bUseFlowControl;
+ pModConf->bKeepAlive = cs.bKeepAlive;
+ if((cs.pszStrmDrvrAuthMode == NULL) || (cs.pszStrmDrvrAuthMode[0] == '\0')) {
+ loadModConf->pszStrmDrvrAuthMode = NULL;
+ } else {
+ loadModConf->pszStrmDrvrAuthMode = cs.pszStrmDrvrAuthMode;
+ }
}
+ if((cs.pszStrmDrvrAuthMode == NULL) || (cs.pszStrmDrvrAuthMode[0] == '\0'))
+ free(cs.pszStrmDrvrAuthMode);
cs.pszStrmDrvrAuthMode = NULL;
loadModConf = NULL; /* done loading */
@@ -527,6 +620,7 @@ BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_IMOD_QUERIES
CODEqueryEtryPt_STD_CONF2_QUERIES
+CODEqueryEtryPt_STD_CONF2_setModCnf_QUERIES
CODEqueryEtryPt_STD_CONF2_PREPRIVDROP_QUERIES
CODEqueryEtryPt_STD_CONF2_IMOD_QUERIES
CODEqueryEtryPt_IsCompatibleWithFeature_IF_OMOD_QUERIES
@@ -549,36 +643,39 @@ CODEmodInit_QueryRegCFSLineHdlr
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverrun"), 0, eCmdHdlrGetWord,
addInstance, NULL, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverkeepalive"), 0, eCmdHdlrBinary,
- NULL, &cs.bKeepAlive, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserversupportoctetcountedframing"), 0, eCmdHdlrBinary,
- NULL, &cs.bSuppOctetFram, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpmaxsessions"), 0, eCmdHdlrInt,
- NULL, &cs.iTCPSessMax, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpmaxlisteners"), 0, eCmdHdlrInt,
- NULL, &cs.iTCPLstnMax, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpservernotifyonconnectionclose"), 0, eCmdHdlrBinary,
- NULL, &cs.bEmitMsgOnClose, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverstreamdrivermode"), 0, eCmdHdlrInt,
- NULL, &cs.iStrmDrvrMode, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverstreamdriverauthmode"), 0, eCmdHdlrGetWord,
- NULL, &cs.pszStrmDrvrAuthMode, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverstreamdriverpermittedpeer"), 0, eCmdHdlrGetWord,
setPermittedPeer, NULL, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserveraddtlframedelimiter"), 0, eCmdHdlrInt,
- NULL, &cs.iAddtlFrameDelim, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverdisablelfdelimiter"), 0, eCmdHdlrBinary,
- NULL, &cs.bDisableLFDelim, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverinputname"), 0, eCmdHdlrGetWord,
NULL, &cs.pszInputName, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpserverbindruleset"), 0, eCmdHdlrGetWord,
NULL, &cs.pszBindRuleset, STD_LOADABLE_MODULE_ID));
- CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("inputtcpflowcontrol"), 0, eCmdHdlrBinary,
- NULL, &cs.bUseFlowControl, STD_LOADABLE_MODULE_ID));
+ /* module-global config params - will be disabled in configs that are loaded
+ * via module(...).
+ */
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpserverstreamdriverauthmode"), 0, eCmdHdlrGetWord,
+ NULL, &cs.pszStrmDrvrAuthMode, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpserverkeepalive"), 0, eCmdHdlrBinary,
+ NULL, &cs.bKeepAlive, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpflowcontrol"), 0, eCmdHdlrBinary,
+ NULL, &cs.bUseFlowControl, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpserverdisablelfdelimiter"), 0, eCmdHdlrBinary,
+ NULL, &cs.bDisableLFDelim, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpserveraddtlframedelimiter"), 0, eCmdHdlrInt,
+ NULL, &cs.iAddtlFrameDelim, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpserversupportoctetcountedframing"), 0, eCmdHdlrBinary,
+ NULL, &cs.bSuppOctetFram, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpmaxsessions"), 0, eCmdHdlrInt,
+ NULL, &cs.iTCPSessMax, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpmaxlisteners"), 0, eCmdHdlrInt,
+ NULL, &cs.iTCPLstnMax, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpservernotifyonconnectionclose"), 0, eCmdHdlrBinary,
+ NULL, &cs.bEmitMsgOnClose, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2(UCHAR_CONSTANT("inputtcpserverstreamdrivermode"), 0, eCmdHdlrInt,
+ NULL, &cs.iStrmDrvrMode, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+
CHKiRet(omsdRegCFSLineHdlr(UCHAR_CONSTANT("resetconfigvariables"), 1, eCmdHdlrCustomHandler,
resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
-
/* vim:set ai:
*/
--
cgit v1.2.3
From cf0fd87e17db12dd28edd260d02d0e5aa96deb71 Mon Sep 17 00:00:00 2001
From: Florian Riedl
Date: Fri, 28 Sep 2012 08:24:13 +0200
Subject: doc: update module doc to new config format
---
doc/imfile.html | 137 ++++++++++++++++++++++++++++++---------
doc/imptcp.html | 70 ++++++++++++++++----
doc/imrelp.html | 28 +++++++-
doc/imudp.html | 55 ++++++++++++----
doc/imuxsock.html | 190 ++++++++++++++++++++++++++++++++++++++++--------------
5 files changed, 373 insertions(+), 107 deletions(-)
diff --git a/doc/imfile.html b/doc/imfile.html
index 7961729b..1594cdce 100644
--- a/doc/imfile.html
+++ b/doc/imfile.html
@@ -36,17 +36,40 @@ file names in the future.
Multiple files may be monitored by specifying
$InputRunFileMonitor multiple times.
+
Configuration Directives:
+Module Directives
-- $InputFileName /path/to/file
+ - PollingInterval
+seconds
+This is a global setting. It specifies how often files are to be polled
+for new data. The time specified is in seconds. The default value is 10
+seconds. Please note that future
+releases of imfile may support per-file polling intervals, but
+currently this is not the case. If multiple PollingInterval
+statements are present in rsyslog.conf, only the last one is used.
+A short poll interval provides more rapid message forwarding, but
+requires more system ressources. While it is possible, we stongly
+recommend not to set the polling interval to 0 seconds. That will make
+rsyslogd become a CPU hog, taking up considerable ressources. It is
+supported, however, for the few very unusual situations where this
+level may be needed. Even if you need quick response, 1 seconds should
+be well enough. Please note that imfile keeps reading files as long as
+there is any data in them. So a "polling sleep" will only happen when
+nothing is left to be processed.
+
+
+Action Directives
+
+- File /path/to/file
The file being monitored. So far, this must be an absolute name (no
macros or templates)
-- $InputFileTag
+
- Tag
tag:
The tag to be used for messages that originate from this file. If you
would like to see the colon after the tag, you need to specify it here
(as shown above).
-- $InputFileStateFile
+
- StateFile
<name-of-state-file>
Rsyslog must keep track of which parts of the to be monitored file it
already processed. This is done in the state file. This file always is
@@ -55,40 +78,19 @@ $WorkDirectory). Be careful to use unique names for different files
being monitored. If there are duplicates, all sorts of "interesting"
things may happen. Rsyslog currently does not check if a name is
specified multiple times.
-- $InputFileFacility
+
- Facility
facility
The syslog facility to be assigned to lines read. Can be specified in
textual form (e.g. "local0", "local1", ...) or as numbers (e.g. 128 for
"local0"). Textual form is suggested. Default is
"local0".
-- $InputFileSeverity
+ - Severity
The
syslog severity to be assigned to lines read. Can be specified in
textual form (e.g. "info", "warning", ...) or as numbers (e.g. 4 for
"info"). Textual form is suggested. Default
is "notice".
-- $InputRunFileMonitor
-This activates
-the current monitor. It has no parameters. If you forget this
-directive, no file monitoring will take place.
-- $InputFilePollInterval
-seconds
-This is a global setting. It specifies how often files are to be polled
-for new data. The time specified is in seconds. The default value is 10
-seconds. Please note that future
-releases of imfile may support per-file polling intervals, but
-currently this is not the case. If multiple $InputFilePollInterval
-statements are present in rsyslog.conf, only the last one is used.
-A short poll interval provides more rapid message forwarding, but
-requires more system ressources. While it is possible, we stongly
-recommend not to set the polling interval to 0 seconds. That will make
-rsyslogd become a CPU hog, taking up considerable ressources. It is
-supported, however, for the few very unusual situations where this
-level may be needed. Even if you need quick response, 1 seconds should
-be well enough. Please note that imfile keeps reading files as long as
-there is any data in them. So a "polling sleep" will only happen when
-nothing is left to be processed.
-- $InputFilePersistStateInterval [lines]
+ - PersistStateInterval [lines]
Available in 4.7.3+, 5.6.2+
Specifies how often the state file shall be written when processing the input
file. The default value is 0, which means a new state file is only written when
@@ -98,9 +100,9 @@ been processed. This setting can be used to guard against message duplication du
to fatal errors (like power fail). Note that this setting affects imfile
performance, especially when set to a low value. Frequently writing the state
file is very time consuming.
- - $InputFileReadMode [mode]
+ - ReadMode [mode]
Available in 5.7.5+
- - $InputFileMaxLinesAtOnce [number]
+ - MaxLinesAtOnce [number]
Available in 5.9.0+
This is useful if multiple files need to be monitored. If set to 0, each file
@@ -109,8 +111,16 @@ will be fully processed and then processing switches to the next file
[number] lines is processed in sequence for each file, and then the file is
switched. This provides a kind of mutiplexing the load of multiple files and
probably leads to a more natural distribution of events when multiple busy files
-are monitored. The default is 10240.
- - $InputFileBindRuleset <ruleset>
+are monitored. The default is 1024.
+ - MaxSubmitAtOnce [number]
+Available in 5.9.0+
+
+This is an expert option. It can be used to set the maximum input batch size that
+imfile can generate. The default is 1024, which is suitable for a wide range of
+applications. Be sure to understand rsyslog message batch processing before you
+modify this option. If you do not know what this doc here talks about, this is a
+good indication that you should NOT modify the default.
+ - Ruleset <ruleset>
Available in 5.7.5+, 6.1.5+
Binds the listener to a specific ruleset.
@@ -132,6 +142,71 @@ your distro puts rsyslog's config files). Note that only commands
actually needed need to be specified. The second file uses less
commands and uses defaults instead.
+
+
+
+Legacy Configuration Directives:
+
+- $InputFileName /path/to/file
+equivalent to: File
+- $InputFileTag
+tag:
+equivalent to: Tag
+- $InputFileStateFile
+<name-of-state-file>
+equivalent to: StateFile
+- $InputFileFacility
+facility
+equivalent to: Facility
+- $InputFileSeverity
+equivalent to: Severity
+- $InputRunFileMonitor
+This activates
+the current monitor. It has no parameters. If you forget this
+directive, no file monitoring will take place.
+- $InputFilePollInterval
+seconds
+equivalent to: PollingInterva
+- $InputFilePersistStateInterval [lines]
+equivalent to: PersistStateInterval
+ - $InputFileReadMode [mode]
+equivalent to: ReadMode
+ - $InputFileMaxLinesAtOnce [number]
+equivalent to: MaxLinesAtOnce
+ - $InputFileBindRuleset <ruleset>
+equivalent to: Ruleset
+
+Caveats/Known Bugs:
+So far, only 100 files can be monitored. If more are needed,
+the source needs to be patched. See define MAX_INPUT_FILES in imfile.c
Powertop
+users may want to notice that imfile utilizes polling. Thus, it is no
+good citizen when it comes to conserving system power consumption. We
+are currently evaluating to move to inotify(). However, there are a
+number of subtle issues, which needs to be worked out first. We will
+make the change as soon as we can. If you can afford it, we recommend
+using a long polling interval in the mean time.
+
+Sample:
+The following sample monitors two files. If you need just one,
+remove the second one. If you need more, add them according to the
+sample ;). This code must be placed in /etc/rsyslog.conf (or wherever
+your distro puts rsyslog's config files). Note that only commands
+actually needed need to be specified. The second file uses less
+commands and uses defaults instead.
+