summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-03-01 07:33:09 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-03-01 07:33:09 +0100
commit2c39f76037328459c5cff14762e0839b1e77d570 (patch)
tree73916a3373e27b3ce8d474348a9d9bdb304165f1
parentf12a1995e42d098217fef22cba6e7158ed76e635 (diff)
downloadrsyslog-2c39f76037328459c5cff14762e0839b1e77d570.tar.gz
rsyslog-2c39f76037328459c5cff14762e0839b1e77d570.tar.xz
rsyslog-2c39f76037328459c5cff14762e0839b1e77d570.zip
make $ActonFileDefaultTemplate available to ompipe
This was not honored by the new ompipe module, because it is a local file directive (it was applied to pipes as a side-effect of using the same module for pipes and files...). I now made this a global, so that semantics are the same as previously. Not really nice, but probably the best thing to do in the current situation (everything else would involve much more overhead --- leave that for the new config system).
-rw-r--r--runtime/srutils.c2
-rw-r--r--tools/omfile.c18
-rw-r--r--tools/omfile.h8
-rw-r--r--tools/ompipe.c6
4 files changed, 19 insertions, 15 deletions
diff --git a/runtime/srutils.c b/runtime/srutils.c
index c403b312..4bd552da 100644
--- a/runtime/srutils.c
+++ b/runtime/srutils.c
@@ -500,12 +500,14 @@ int decodeSyslogName(uchar *name, syslogName_t *codetab)
for (p = buf; *p; p++)
if (isupper((int) *p))
*p = tolower((int) *p);
+dbgprintf("obtained syslogName '%s'\n", buf);
for (c = codetab; c->c_name; c++)
if (!strcmp((char*) buf, (char*) c->c_name))
{
dbgprintf(" ==> %d\n", c->c_val);
return (c->c_val);
}
+dbgprintf("syslogName '%s' NOT found!\n", buf);
return (-1);
}
diff --git a/tools/omfile.c b/tools/omfile.c
index 18f683bb..069fc078 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -102,7 +102,7 @@ static int iZipLevel = 0; /* zip compression mode (0..9 as usual) */
static bool bFlushOnTXEnd = 1;/* flush write buffers when transaction has ended? */
static int64 iIOBufSize = IOBUF_DFLT_SIZE; /* size of an io buffer */
static int iFlushInterval = FLUSH_INTRVL_DFLT; /* how often flush the output buffer on inactivity? */
-static uchar *pszTplName = NULL; /* name of the default template to use */
+uchar *pszFileDfltTplName = NULL; /* name of the default template to use */
/* end globals for default values */
@@ -258,7 +258,7 @@ static rsRetVal cflineParseOutchannel(instanceData *pData, uchar* p, omodStringR
pData->pszSizeLimitCmd = pOch->cmdOnSizeLimit;
iRet = cflineParseTemplateName(&p, pOMSR, iEntry, iTplOpts,
- (pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName);
+ (pszFileDfltTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszFileDfltTplName);
finalize_it:
RETiRet;
@@ -653,7 +653,7 @@ CODESTARTparseSelectorAct
CODE_STD_STRING_REQUESTparseSelectorAct(2)
++p; /* eat '?' */
CHKiRet(cflineParseFileName(p, (uchar*) pData->f_fname, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,
- (pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName));
+ (pszFileDfltTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszFileDfltTplName));
/* "filename" is actually a template name, we need this as string 1. So let's add it
* to the pOMSR. -- rgerhards, 2007-07-27
*/
@@ -683,7 +683,7 @@ CODESTARTparseSelectorAct
}
CHKiRet(cflineParseFileName(p, (uchar*) pData->f_fname, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,
- (pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName));
+ (pszFileDfltTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszFileDfltTplName));
pData->bDynamicName = 0;
break;
default:
@@ -739,9 +739,9 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
bFlushOnTXEnd = 1;
iIOBufSize = IOBUF_DFLT_SIZE;
iFlushInterval = FLUSH_INTRVL_DFLT;
- if(pszTplName != NULL) {
- free(pszTplName);
- pszTplName = NULL;
+ if(pszFileDfltTplName != NULL) {
+ free(pszFileDfltTplName);
+ pszFileDfltTplName = NULL;
}
return RS_RET_OK;
@@ -766,7 +766,7 @@ BEGINmodExit
CODESTARTmodExit
objRelease(errmsg, CORE_COMPONENT);
objRelease(strm, CORE_COMPONENT);
- free(pszTplName);
+ free(pszFileDfltTplName);
ENDmodExit
@@ -797,7 +797,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr((uchar *)"createdirs", 0, eCmdHdlrBinary, NULL, &bCreateDirs, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"failonchownfailure", 0, eCmdHdlrBinary, NULL, &bFailOnChown, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionfileenablesync", 0, eCmdHdlrBinary, NULL, &bEnableSync, STD_LOADABLE_MODULE_ID));
- CHKiRet(regCfSysLineHdlr((uchar *)"actionfiledefaulttemplate", 0, eCmdHdlrGetWord, NULL, &pszTplName, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"actionfiledefaulttemplate", 0, eCmdHdlrGetWord, NULL, &pszFileDfltTplName, NULL));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
/* vi:set ai:
diff --git a/tools/omfile.h b/tools/omfile.h
index 09031dac..8dca6a88 100644
--- a/tools/omfile.h
+++ b/tools/omfile.h
@@ -28,7 +28,11 @@
/* prototypes */
rsRetVal modInitFile(int iIFVersRequested __attribute__((unused)), int *ipIFVersProvided, rsRetVal (**pQueryEtryPt)(), rsRetVal (*pHostQueryEtryPt)(uchar*, rsRetVal (**)()), modInfo_t*);
+/* the define below is dirty, but we need it for ompipe integration. There is no
+ * other way to have the functionality (well, one way would be to go through the
+ * globals, but that seems not yet justified. -- rgerhards, 2010-03-01
+ */
+uchar *pszFileDfltTplName;
#endif /* #ifndef OMFILE_H_INCLUDED */
-/*
- * vi:set ai:
+/* vi:set ai:
*/
diff --git a/tools/ompipe.c b/tools/ompipe.c
index 3355bcb4..5fb9b27e 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -46,6 +46,7 @@
#include "srUtils.h"
#include "template.h"
#include "ompipe.h"
+#include "omfile.h" /* for dirty trick: access to $ActionFileDefaultTemplate value */
#include "cfsysline.h"
#include "module-template.h"
#include "conf.h"
@@ -60,7 +61,6 @@ DEFobjCurrIf(errmsg)
/* globals for default values */
-static uchar *pszTplName = NULL; /* name of the default template to use */
/* end globals for default values */
@@ -192,7 +192,7 @@ CODESTARTparseSelectorAct
* and then look at the rest of the line.
*/
CHKiRet(cflineParseFileName(p, (uchar*) pData->f_fname, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,
- (pszTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszTplName));
+ (pszFileDfltTplName == NULL) ? (uchar*)"RSYSLOG_FileFormat" : pszFileDfltTplName));
/* at this stage, we ignore the return value of preparePipe, this is taken
* care of in later steps. -- rgerhards, 2009-03-19
@@ -219,8 +219,6 @@ ENDdoHUP
BEGINmodExit
CODESTARTmodExit
- if(pszTplName != NULL)
- free(pszTplName);
ENDmodExit