summaryrefslogtreecommitdiffstats
path: root/template.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-03-21 10:08:21 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-03-21 10:08:21 +0100
commitf82f810ca8db889e18dcedabcfe9f8a149ffabc6 (patch)
tree1cb6e76b925a58e93b33fe44cea767abb215045c /template.c
parent459f0d094fcb48fd58204ad3527f931715839bcb (diff)
parente2f13df22c7599fa1fc7d6b4c20081aac78b355a (diff)
downloadrsyslog-f82f810ca8db889e18dcedabcfe9f8a149ffabc6.tar.gz
rsyslog-f82f810ca8db889e18dcedabcfe9f8a149ffabc6.tar.xz
rsyslog-f82f810ca8db889e18dcedabcfe9f8a149ffabc6.zip
Merge branch 'v5-beta' into v5-beta-strgen-bind
Diffstat (limited to 'template.c')
-rw-r--r--template.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/template.c b/template.c
index 5aaf1bcb..cc339653 100644
--- a/template.c
+++ b/template.c
@@ -856,19 +856,37 @@ tplAddTplMod(struct template *pTpl, uchar** ppRestOfConfLine)
{
uchar *pSrc, *pDst;
uchar szMod[2048];
+ unsigned lenMod;
strgen_t *pStrgen;
DEFiRet;
pSrc = *ppRestOfConfLine;
pDst = szMod;
- while(*pSrc && !isspace(*pSrc) && pDst < &(szMod[sizeof(szMod) - 1])) {
- *pDst++ = *pSrc++;
+ lenMod = 0;
+ while(*pSrc && !isspace(*pSrc) && lenMod < sizeof(szMod) - 1) {
+ szMod[lenMod] = *pSrc++;
+ lenMod++;
+
}
- *pDst = '\0';
+ szMod[lenMod] = '\0';
*ppRestOfConfLine = pSrc;
CHKiRet(strgen.FindStrgen(&pStrgen, szMod));
pTpl->pStrgen = pStrgen->pModule->mod.sm.strgen;
- dbgprintf("template bound to strgen '%s'\n", szMod);
+ DBGPRINTF("template bound to strgen '%s'\n", szMod);
+ /* check if the name potentially contains some well-known options
+ * Note: we have opted to let the name contain all options. This sounds
+ * useful, because the strgen MUST actually implement a specific set
+ * of options. Doing this via the name looks to the enduser as if the
+ * regular syntax were used, and it make sure the strgen postively
+ * acknowledged implementing the option. -- rgerhards, 2011-03-21
+ */
+ if(lenMod > 6 && !strcasecmp((char*) szMod + lenMod - 4, ",stdsql")) {
+ pTpl->optFormatForSQL = 2;
+ DBGPRINTF("strgen suports the stdsql option\n");
+ } else if(lenMod > 3 && !strcasecmp((char*) szMod+ lenMod - 7, ",sql")) {
+ pTpl->optFormatForSQL = 1;
+ DBGPRINTF("strgen suports the sql option\n");
+ }
finalize_it:
RETiRet;
@@ -936,8 +954,7 @@ struct template *tplAddLine(char* pName, uchar** ppRestOfConfLine)
/* we simply make the template defunct in this case by setting
* its name to a zero-string. We do not free it, as this would
* require additional code and causes only a very small memory
- * consumption. Memory is freed, however, in normal operation
- * and most importantly by HUPing syslogd.
+ * consumption.
*/
*pTpl->pszName = '\0';
return NULL;