summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-15 14:51:29 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-15 14:51:29 +0200
commit90ef0f7a0b3cd025e30611cd30d72beaf86ff18b (patch)
treefcd439784db76a2c39fc7ce43c53cfc5c02639fd
parent57722664bcdfcd7be425ad3db02a884ff8c17f47 (diff)
parent72c235744023d10e1a9b44c90b65a6b34029e471 (diff)
downloadrsyslog-90ef0f7a0b3cd025e30611cd30d72beaf86ff18b.tar.gz
rsyslog-90ef0f7a0b3cd025e30611cd30d72beaf86ff18b.tar.xz
rsyslog-90ef0f7a0b3cd025e30611cd30d72beaf86ff18b.zip
Merge branch 'v5-devel'
Conflicts: plugins/impstats/impstats.c
-rw-r--r--ChangeLog18
-rw-r--r--doc/impstats.html10
-rw-r--r--doc/omrelp.html1
-rw-r--r--plugins/impstats/impstats.c2
-rw-r--r--plugins/omrelp/omrelp.c14
-rw-r--r--plugins/sm_cust_bindcdr/sm_cust_bindcdr.c14
-rw-r--r--runtime/rule.c4
-rw-r--r--runtime/sysvar.c4
-rw-r--r--runtime/vm.c18
9 files changed, 70 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 8b4b38f4..8cb32406 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@ Version 6.1.7 [DEVEL] (rgerhards), 2011-03-??
- bugfix (kind of): memory leak with tcp reception epoll handler
This was an extremely unlikely leak and, if it happend, quite small.
Still it is better to handle this border case.
+- bugfix: IPv6-address could not be specified in omrelp
+ this was due to improper parsing of ":"
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=250
---------------------------------------------------------------------------
Version 6.1.6 [DEVEL] (rgerhards), 2011-03-14
- enhanced omhdfs to support batching mode. This permits to increase
@@ -164,6 +167,18 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-03-??
affected directive was: $ActionExecOnlyWhenPreviousIsSuspended on
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=236
---------------------------------------------------------------------------
+Version 5.8.1 [V5-stable] (rgerhards), 2011-04-??
+- bugfix: $myhostname not available in RainerScript (and no error message)
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=233
+- bugfix: doc for impstats had wrong config statements
+ also, config statements were named a bit inconsistent, resolved that
+ problem by introducing an alias and only documenting the consistent
+ statements
+ Thanks to Marcin for bringing up this problem.
+- bugfix: IPv6-address could not be specified in omrelp
+ this was due to improper parsing of ":"
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=250
+---------------------------------------------------------------------------
Version 5.8.0 [V5-stable] (rgerhards), 2011-04-12
This is the new v5-stable branch, importing all feature from the 5.7.x
@@ -949,6 +964,9 @@ Version 4.7.0 [v4-devel] (rgerhards), 2010-04-14
- imported changes from 4.5.6 and below
---------------------------------------------------------------------------
Version 4.6.6 [v4-stable] (rgerhards), 2010-11-??
+- bugfix: IPv6-address could not be specified in omrelp
+ this was due to improper parsing of ":"
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=250
- bugfix: imfile potentially duplicates lines
This can happen when 0 bytes are read from the input file, and some
writer appends data to the file BEFORE we check if a rollover happens.
diff --git a/doc/impstats.html b/doc/impstats.html
index 3b4191e8..cede4874 100644
--- a/doc/impstats.html
+++ b/doc/impstats.html
@@ -22,16 +22,16 @@ settings, this impact may be severe (for high-load environments).
</p>
<p><b>Configuration Directives</b>:</p>
<ul>
-<li>$PStatsInterval &lt;Seconds&gt;<br>
+<li>$PStatInterval &lt;Seconds&gt;<br>
Sets the interval, in <b>seconds</b> at which messages are generated. Please note that the
actual interval may be a bit longer. We do not try to be precise and so the interval is
actually a sleep period which is entered after generating all messages. So the actual
interval is what is configured here plus the actual time required to generate messages.
In general, the difference should not really matter.
-<li>$PStatsFacility &lt;numerical facility&gt;<br>
+<li>$PStatFacility &lt;numerical facility&gt;<br>
The numerical syslog facility code to be used for generated messages. Default
is 5 (syslog).This is useful for filtering messages.</li>
-<li>$PStatsSeverity &lt;numerical severity&gt;<br>
+<li>$PStatSeverity &lt;numerical severity&gt;<br>
The numerical syslog severity code to be used for generated messages. Default
is 6 (info).This is useful for filtering messages.</li>
</ul>
@@ -45,8 +45,8 @@ stats may not get turned on in all places.</li>
<p>This activates the module and records messages to /var/log/rsyslog-stats in 10 minute intervals:<br>
</p>
<textarea rows="8" cols="60">$ModLoad impstats
-$PStatsInterval 600
-$PStatsSeverity 7
+$PStatInterval 600
+$PStatSeverity 7
syslog.debug /var/log/rsyslog-stats
</textarea>
diff --git a/doc/omrelp.html b/doc/omrelp.html
index b3132d78..22e6845f 100644
--- a/doc/omrelp.html
+++ b/doc/omrelp.html
@@ -44,6 +44,7 @@ special "RSYSLOG_ForwardFormat" (case sensitive!) template is used.<br>
# port 2514
*.* :omrelp:centralserv:2514;RSYSLOG_ForwardFormat
</textarea>
+Note: to use IPv6 addresses, encode them in [::1] format.
<p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>]
[<a href="manual.html">manual index</a>] [<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
<p><font size="2">This documentation is part of the
diff --git a/plugins/impstats/impstats.c b/plugins/impstats/impstats.c
index cbe1779d..35851231 100644
--- a/plugins/impstats/impstats.c
+++ b/plugins/impstats/impstats.c
@@ -212,7 +212,9 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(prop, CORE_COMPONENT));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(statsobj, CORE_COMPONENT));
+ /* the pstatsinverval is an alias to support a previous screwed-up syntax... */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatsinterval", 0, eCmdHdlrInt, NULL, &cs.iStatsInterval, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatinterval", 0, eCmdHdlrInt, NULL, &cs.iStatsInterval, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatfacility", 0, eCmdHdlrInt, NULL, &cs.iFacility, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatseverity", 0, eCmdHdlrInt, NULL, &cs.iSeverity, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID, eConfObjGlobal));
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index e6fed40a..26e8ccd3 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -261,8 +261,18 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* extract the host first (we do a trick - we replace the ';' or ':' with a '\0')
* now skip to port and then template name. rgerhards 2005-07-06
*/
- for(q = p ; *p && *p != ';' && *p != ':' ; ++p)
- /* JUST SKIP */;
+ if(*p == '[') { /* everything is hostname upto ']' */
+ ++p; /* skip '[' */
+ for(q = p ; *p && *p != ']' ; ++p)
+ /* JUST SKIP */;
+ if(*p == ']') {
+ *p = '\0'; /* trick to obtain hostname (later)! */
+ ++p; /* eat it */
+ }
+ } else { /* traditional view of hostname */
+ for(q = p ; *p && *p != ';' && *p != ':' && *p != '#' ; ++p)
+ /* JUST SKIP */;
+ }
pData->port = NULL;
if(*p == ':') { /* process port */
diff --git a/plugins/sm_cust_bindcdr/sm_cust_bindcdr.c b/plugins/sm_cust_bindcdr/sm_cust_bindcdr.c
index 91394772..0fa1a4c4 100644
--- a/plugins/sm_cust_bindcdr/sm_cust_bindcdr.c
+++ b/plugins/sm_cust_bindcdr/sm_cust_bindcdr.c
@@ -122,7 +122,8 @@ finalize_it:
* An actual message sample for what we intend to parse is (one line):
<30>Mar 24 13:01:51 named[6085]: 24-Mar-2011 13:01:51.865 queries: info: client 10.0.0.96#39762: view trusted: query: 8.6.0.9.9.4.1.4.6.1.8.3.mobilecrawler.com IN TXT + (10.0.0.96)
*/
-#define SQL_STMT "INSERT INTO CDR(`Date`,`Time`, timeMS, client, view, query, ip) VALUES ('"
+//previos dev: #define SQL_STMT "INSERT INTO CDR(`Date`,`Time`, timeMS, client, view, query, ip) VALUES ('"
+#define SQL_STMT "INSERT INTO CDR(`date`,ip,user,dest) VALUES ('"
#define ADD_SQL_DELIM \
memcpy(*ppBuf + iBuf, "', '", sizeof("', '") - 1); \
iBuf += sizeof("', '") - 1;
@@ -316,16 +317,21 @@ CODESTARTstrgen
memcpy(*ppBuf + iBuf, szDate, lenDate);
iBuf += lenDate;
- ADD_SQL_DELIM
+ /* prviously: ADD_SQL_DELIM */
+ *(*ppBuf + iBuf) = ' ';
+ ++iBuf;
memcpy(*ppBuf + iBuf, szTime, lenTime);
iBuf += lenTime;
ADD_SQL_DELIM
+ /* we shall now discard this part
memcpy(*ppBuf + iBuf, szMSec, lenMSec);
iBuf += lenMSec;
ADD_SQL_DELIM
+ */
+ /* Note that this seem to be the IP to use */
memcpy(*ppBuf + iBuf, szClient, lenClient);
iBuf += lenClient;
ADD_SQL_DELIM
@@ -336,10 +342,12 @@ CODESTARTstrgen
memcpy(*ppBuf + iBuf, szQuery, lenQuery);
iBuf += lenQuery;
- ADD_SQL_DELIM
+ /* this is now the last field, so we dont need: ADD_SQL_DELIM */
+ /* no longer to be included
memcpy(*ppBuf + iBuf, szIP, lenIP);
iBuf += lenIP;
+ */
/* end of SQL statement/trailer (NUL is contained in string!) */
memcpy(*ppBuf + iBuf, SQL_STMT_END, sizeof(SQL_STMT_END));
diff --git a/runtime/rule.c b/runtime/rule.c
index fc1ee17c..7c3e5131 100644
--- a/runtime/rule.c
+++ b/runtime/rule.c
@@ -179,7 +179,7 @@ shouldProcessThisMessage(rule_t *pRule, msg_t *pMsg, sbool *bProcessMsg)
if(pRule->f_filter_type == FILTER_PRI) {
/* skip messages that are incorrect priority */
-dbgprintf("testing filter, f_pmask %d\n", pRule->f_filterData.f_pmask[pMsg->iFacility]);
+ dbgprintf("testing filter, f_pmask %d\n", pRule->f_filterData.f_pmask[pMsg->iFacility]);
if ( (pRule->f_filterData.f_pmask[pMsg->iFacility] == TABLE_NOPRI) || \
((pRule->f_filterData.f_pmask[pMsg->iFacility] & (1<<pMsg->iSeverity)) == 0) )
bRet = 0;
@@ -191,7 +191,7 @@ dbgprintf("testing filter, f_pmask %d\n", pRule->f_filterData.f_pmask[pMsg->iFac
CHKiRet(vm.SetMsg(pVM, pMsg));
CHKiRet(vm.ExecProg(pVM, pRule->f_filterData.f_expr->pVmprg));
CHKiRet(vm.PopBoolFromStack(pVM, &pResult));
- dbgprintf("result of expression evaluation: %lld\n", pResult->val.num);
+ dbgprintf("result of rainerscript filter evaluation: %lld\n", pResult->val.num);
/* VM is destructed on function exit */
bRet = (pResult->val.num) ? 1 : 0;
} else {
diff --git a/runtime/sysvar.c b/runtime/sysvar.c
index 4a6ace19..ecc31e2d 100644
--- a/runtime/sysvar.c
+++ b/runtime/sysvar.c
@@ -41,6 +41,7 @@
DEFobjStaticHelpers
DEFobjCurrIf(var)
DEFobjCurrIf(datetime)
+DEFobjCurrIf(glbl)
/* Standard-Constructor
@@ -146,6 +147,8 @@ GetVar(cstr_t *pstrVarName, var_t **ppVar)
CHKiRet(getNOW(NOW_HOUR, &pstrProp));
} else if(!rsCStrSzStrCmp(pstrVarName, (uchar*)"minute", sizeof("minute") - 1)) {
CHKiRet(getNOW(NOW_MINUTE, &pstrProp));
+ } else if(!rsCStrSzStrCmp(pstrVarName, (uchar*)"myhostname", sizeof("myhostname") - 1)) {
+ CHKiRet(rsCStrConstructFromszStr(&pstrProp, glbl.GetLocalHostName()));
} else {
ABORT_FINALIZE(RS_RET_SYSVAR_NOT_FOUND);
}
@@ -191,6 +194,7 @@ BEGINObjClassInit(sysvar, 1, OBJ_IS_CORE_MODULE) /* class, version */
/* request objects we use */
CHKiRet(objUse(var, CORE_COMPONENT));
CHKiRet(objUse(datetime, CORE_COMPONENT));
+ CHKiRet(objUse(glbl, CORE_COMPONENT));
/* set our own handlers */
OBJSetMethodHandler(objMethod_CONSTRUCTION_FINALIZER, sysvarConstructFinalize);
diff --git a/runtime/vm.c b/runtime/vm.c
index c5521c31..bbc8d346 100644
--- a/runtime/vm.c
+++ b/runtime/vm.c
@@ -288,7 +288,7 @@ BEGINCMPOP(CMP_NEQ) /* remember to change the name also in the END macro! */
case VARTYPE_STR:
bRes = rsCStrCStrCmp(operand1->val.pStr, operand2->val.pStr);
break;
-ENDCMPOP(CMP_EQ)
+ENDCMPOP(CMP_NEQ)
BEGINCMPOP(CMP_LT) /* remember to change the name also in the END macro! */
case VARTYPE_NUMBER:
@@ -500,6 +500,15 @@ CODESTARTop(PUSHSYSVAR)
CHKiRet(sysvar.GetVar(pOp->operand.pVar->val.pStr, &pVal));
vmstk.Push(pThis->pStk, pVal);
finalize_it:
+ if(Debug && iRet != RS_RET_OK) {
+ if(iRet == RS_RET_SYSVAR_NOT_FOUND) {
+ DBGPRINTF("rainerscript: sysvar '%s' not found\n",
+ rsCStrGetSzStrNoNULL(pOp->operand.pVar->val.pStr));
+ } else {
+ DBGPRINTF("rainerscript: error %d trying to obtain sysvar '%s'\n",
+ iRet, rsCStrGetSzStrNoNULL(pOp->operand.pVar->val.pStr));
+ }
+ }
ENDop(PUSHSYSVAR)
/* The function call operation is only very roughly implemented. While the plumbing
@@ -692,9 +701,11 @@ execProg(vm_t *pThis, vmprg_t *pProg)
ISOBJ_TYPE_assert(pThis, vm);
ISOBJ_TYPE_assert(pProg, vmprg);
-#define doOP(OP) case opcode_##OP: CHKiRet(op##OP(pThis, pCurrOp)); break
+#define doOP(OP) case opcode_##OP: DBGPRINTF("rainerscript: opcode %s\n", #OP); \
+ CHKiRet(op##OP(pThis, pCurrOp)); break
pCurrOp = pProg->vmopRoot; /* TODO: do this via a method! */
while(pCurrOp != NULL && pCurrOp->opcode != opcode_END_PROG) {
+ DBGPRINTF("rainerscript: executing step, opcode %d...\n", pCurrOp->opcode);
switch(pCurrOp->opcode) {
doOP(OR);
doOP(AND);
@@ -722,8 +733,8 @@ execProg(vm_t *pThis, vmprg_t *pProg)
doOP(UNARY_MINUS);
doOP(FUNC_CALL);
default:
- ABORT_FINALIZE(RS_RET_INVALID_VMOP);
dbgoprint((obj_t*) pThis, "invalid instruction %d in vmprg\n", pCurrOp->opcode);
+ ABORT_FINALIZE(RS_RET_INVALID_VMOP);
break;
}
/* so far, we have plain sequential execution, so on to next... */
@@ -736,6 +747,7 @@ execProg(vm_t *pThis, vmprg_t *pProg)
*/
finalize_it:
+ DBGPRINTF("rainerscript: script execution terminated with state %d\n", iRet);
RETiRet;
}