I'm working on an rsyslog output plugin and spent some time this morning
reading the code for other plugins.  I've figured out that rsyslog supports
passing vars from the template as an array.

In array passing mode, this seems to be the idiom to get at the passed
values:

szParams = (char**)(void*) (ppString[0]);

In non array mode, it looks like the template string is passed as such:

toWrite = (char*) ppString[0];

For my particular use, I currently do not need array passing.  I also only
want to support version 6 config syntax.  I'm still learning my way around
the plugin code and wanted to double check that my BeginModInit() is
sufficient:

223 BEGINmodInit()
224 CODESTARTmodInit
225     *ipIFVersProvided = CURR_MOD_IF_VERSION; /* only supports rsyslog 6
configs */
226 CODEmodInit_QueryRegCFSLineHdlr
227     CHKiRet(objUse(errmsg, CORE_COMPONENT));
228     INITChkCoreFeature(bCoreSupportsBatching, CORE_FEATURE_BATCHING);
229     DBGPRINTF("testmod: module compiled with rsyslog version %s.\n",
VERSION);
230 ENDmodInit

Then in BegindoAction, I would:

145 BEGINdoAction
146 CODESTARTdoAction
147     iRet = writeAction(ppString[0], pData);
148 ENDdoAction

I'm starting to get an understanding of the various sections of an rsyslog
plugin, so that I actually understand what's going on and it's not just
boilerplate for me.

Thanks!
Brian
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/

Reply via email to