summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-15 10:23:19 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-15 10:23:19 +0200
commit72c235744023d10e1a9b44c90b65a6b34029e471 (patch)
treed6e14606cc430beeead93d68fc46de7ed82915c1
parent9105946272e4190e042981f35994b3f044ebb0d3 (diff)
parent254dc643c260c0f4a489188b2277811a4104063e (diff)
downloadrsyslog-72c235744023d10e1a9b44c90b65a6b34029e471.tar.gz
rsyslog-72c235744023d10e1a9b44c90b65a6b34029e471.tar.xz
rsyslog-72c235744023d10e1a9b44c90b65a6b34029e471.zip
Merge branch 'v5-stable' into v5-devel
Conflicts: ChangeLog
-rw-r--r--ChangeLog15
-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, 67 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index c53f3753..3cc13082 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,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
@@ -795,6 +807,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 aa98ae9d..cfbbad76 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));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatinterval", 0, eCmdHdlrInt, NULL, &cs.iStatsInterval, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatfacility", 0, eCmdHdlrInt, NULL, &cs.iFacility, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"pstatseverity", 0, eCmdHdlrInt, NULL, &cs.iSeverity, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index cf70381f..1453d68f 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -251,8 +251,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 3fe96ac4..baad667e 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 42773768..d5f18e71 100644
--- a/runtime/rule.c
+++ b/runtime/rule.c
@@ -173,7 +173,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;
@@ -185,7 +185,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 0ed174d1..84ba4bcf 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:
@@ -474,6 +474,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
@@ -666,9 +675,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);
@@ -695,8 +706,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... */
@@ -709,6 +720,7 @@ execProg(vm_t *pThis, vmprg_t *pProg)
*/
finalize_it:
+ DBGPRINTF("rainerscript: script execution terminated with state %d\n", iRet);
RETiRet;
}