summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--runtime/conf.c31
-rw-r--r--runtime/module-template.h2
-rw-r--r--runtime/rsyslog.h1
-rw-r--r--tools/omusrmsg.c4
5 files changed, 35 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 173cc63f..d80e7c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 5.9.3 [V5-DEVEL] (al), 2011-??-??
+- added capability to emit config error location info for warnings
+ otherwise, omusrmsg's warning about new config format was not
+ accompanied by problem location.
- bugfix: potential misadressing in property replacer
---------------------------------------------------------------------------
Version 5.9.2 [V5-DEVEL] (rgerhards), 2011-07-11
diff --git a/runtime/conf.c b/runtime/conf.c
index cc8c205e..858dbbfa 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -403,6 +403,7 @@ processConfFile(uchar *pConfFile)
uchar cbuf[CFGLNSIZ];
uchar *cline;
int i;
+ rsRetVal localRet;
int bHadAnError = 0;
uchar *pszOrgLine = NULL;
size_t lenLine;
@@ -461,16 +462,20 @@ processConfFile(uchar *pConfFile)
/* we now have the complete line, and are positioned at the first non-whitespace
* character. So let's process it
*/
- if(cfline(cbuf, &pCurrRule) != RS_RET_OK) {
+ if((localRet = cfline(cbuf, &pCurrRule)) != RS_RET_OK) {
/* we log a message, but otherwise ignore the error. After all, the next
* line can be correct. -- rgerhards, 2007-08-02
*/
uchar szErrLoc[MAXFNAME + 64];
- dbgprintf("config line NOT successfully processed\n");
+ if(localRet != RS_RET_OK_WARN) {
+ dbgprintf("config line NOT successfully processed\n");
+ bHadAnError = 1;
+ }
snprintf((char*)szErrLoc, sizeof(szErrLoc) / sizeof(uchar),
"%s, line %d", pConfFile, iLnNbr);
- errmsg.LogError(0, NO_ERRCODE, "the last error occured in %s:\"%s\"", (char*)szErrLoc, (char*)pszOrgLine);
- bHadAnError = 1;
+ errmsg.LogError(0, NO_ERRCODE, "the last %s occured in %s:\"%s\"",
+ (localRet == RS_RET_OK_WARN) ? "warning" : "error",
+ (char*)szErrLoc, (char*)pszOrgLine);
}
}
@@ -1079,6 +1084,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
omodStringRequest_t *pOMSR;
action_t *pAction = NULL;
void *pModData;
+ int bHadWarning = 0;
ASSERT(p != NULL);
ASSERT(ppAction != NULL);
@@ -1094,6 +1100,10 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
pOMSR = NULL;
iRet = pMod->mod.om.parseSelectorAct(p, &pModData, &pOMSR);
dbgprintf("tried selector action for %s: %d\n", module.GetName(pMod), iRet);
+ if(iRet == RS_RET_OK_WARN) {
+ bHadWarning = 1;
+ iRet = RS_RET_OK;
+ }
if(iRet == RS_RET_OK || iRet == RS_RET_SUSPENDED) {
if((iRet = addAction(&pAction, pMod, pModData, pOMSR, (iRet == RS_RET_SUSPENDED)? 1 : 0)) == RS_RET_OK) {
/* now check if the module is compatible with select features */
@@ -1122,6 +1132,8 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
}
*ppAction = pAction;
+ if(iRet == RS_RET_OK && bHadWarning)
+ iRet = RS_RET_OK_WARN;
RETiRet;
}
@@ -1136,6 +1148,8 @@ cflineClassic(uchar *p, rule_t **ppRule)
{
DEFiRet;
action_t *pAction;
+ rsRetVal localRet;
+ int bHadWarning = 0;
/* lines starting with '&' have no new filters and just add
* new actions to the currently processed selector.
@@ -1162,10 +1176,17 @@ cflineClassic(uchar *p, rule_t **ppRule)
CHKiRet(cflineDoFilter(&p, *ppRule)); /* pull filters */
}
- CHKiRet(cflineDoAction(&p, &pAction));
+ localRet = cflineDoAction(&p, &pAction);
+ if(localRet == RS_RET_OK_WARN) {
+ bHadWarning = 1;
+ } else {
+ CHKiRet(localRet);
+ }
CHKiRet(llAppend(&(*ppRule)->llActList, NULL, (void*) pAction));
finalize_it:
+ if(iRet == RS_RET_OK && bHadWarning)
+ iRet = RS_RET_OK_WARN;
RETiRet;
}
diff --git a/runtime/module-template.h b/runtime/module-template.h
index c2585e67..54c67135 100644
--- a/runtime/module-template.h
+++ b/runtime/module-template.h
@@ -275,7 +275,7 @@ static rsRetVal parseSelectorAct(uchar **pp, void **ppModData, omodStringRequest
#define CODE_STD_FINALIZERparseSelectorAct \
finalize_it:\
- if(iRet == RS_RET_OK || iRet == RS_RET_SUSPENDED) {\
+ if(iRet == RS_RET_OK || iRet == RS_RET_OK_WARN || iRet == RS_RET_SUSPENDED) {\
*ppModData = pData;\
*pp = p;\
} else {\
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index d20cd5bb..65ed70db 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -345,6 +345,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_WRN_WRKDIR = -2182, /**< correctable problems with the rsyslog working directory */
RS_RET_ERR_QUEUE_EMERGENCY = -2183, /**< some fatal error caused queue to switch to emergency mode */
RS_RET_OUTDATED_STMT = -2184, /**< some outdated statement/functionality is being used in conf file */
+ RS_RET_OK_WARN = -2185, /**< config part: everything was OK, but a warning message was emitted */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
diff --git a/tools/omusrmsg.c b/tools/omusrmsg.c
index 6d46813e..459e5fd6 100644
--- a/tools/omusrmsg.c
+++ b/tools/omusrmsg.c
@@ -273,6 +273,7 @@ ENDdoAction
BEGINparseSelectorAct
uchar *q;
int i;
+ int bHadWarning = 0;
CODESTARTparseSelectorAct
CODE_STD_STRING_REQUESTparseSelectorAct(1)
/* User names must begin with a gnu e-regex:
@@ -290,6 +291,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
"action '%s' treated as ':omusrmsg:%s' - please "
"change syntax, '%s' will not be supported in the future",
p, p, p);
+ bHadWarning = 1;
}
}
@@ -325,6 +327,8 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
!= RS_RET_OK)
goto finalize_it;
}
+ if(iRet == RS_RET_OK && bHadWarning)
+ iRet = RS_RET_OK_WARN;
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct