mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-20 02:40:42 +01:00
action: use new errmsg interface
This commit is contained in:
parent
0f95dce5be
commit
f6352925ae
24
action.c
24
action.c
@ -134,7 +134,6 @@ static rsRetVal doSubmitToActionQNotAllMark(action_t * const pAction, wti_t * co
|
||||
DEFobjCurrIf(obj)
|
||||
DEFobjCurrIf(datetime)
|
||||
DEFobjCurrIf(module)
|
||||
DEFobjCurrIf(errmsg)
|
||||
DEFobjCurrIf(statsobj)
|
||||
DEFobjCurrIf(ruleset)
|
||||
|
||||
@ -432,7 +431,7 @@ actionConstructFinalize(action_t *__restrict__ const pThis, struct nvlst *lst)
|
||||
int i;
|
||||
for(i = 0 ; i < pThis->iNumTpls ; ++i) {
|
||||
if(pThis->peParamPassing[i] != ACT_STRING_PASSING) {
|
||||
errmsg.LogError(0, RS_RET_INVLD_OMOD, "action '%s'(%d) is transactional but "
|
||||
LogError(0, RS_RET_INVLD_OMOD, "action '%s'(%d) is transactional but "
|
||||
"parameter %d "
|
||||
"uses invalid parameter passing mode -- disabling "
|
||||
"action. This is probably caused by a pre-v7 "
|
||||
@ -514,12 +513,12 @@ actionConstructFinalize(action_t *__restrict__ const pThis, struct nvlst *lst)
|
||||
/* ... set some properties ... */
|
||||
# define setQPROP(func, directive, data) \
|
||||
CHKiRet_Hdlr(func(pThis->pQueue, data)) { \
|
||||
errmsg.LogError(0, NO_ERRCODE, "Invalid " #directive ", \
|
||||
LogError(0, NO_ERRCODE, "Invalid " #directive ", \
|
||||
error %d. Ignored, running with default setting", iRet); \
|
||||
}
|
||||
# define setQPROPstr(func, directive, data) \
|
||||
CHKiRet_Hdlr(func(pThis->pQueue, data, (data == NULL)? 0 : strlen((char*) data))) { \
|
||||
errmsg.LogError(0, NO_ERRCODE, "Invalid " #directive ", \
|
||||
LogError(0, NO_ERRCODE, "Invalid " #directive ", \
|
||||
error %d. Ignored, running with default setting", iRet); \
|
||||
}
|
||||
setQPROP(qqueueSetsizeOnDiskMax, "$ActionQueueMaxDiskSpace", cs.iActionQueMaxDiskSpace);
|
||||
@ -730,7 +729,7 @@ actionSuspend(action_t * const pThis, wti_t * const pWti)
|
||||
|| (pThis->bReportSuspension && getActionNbrResRtry(pWti, pThis) == 0) ) {
|
||||
ctime_r(&pThis->ttResumeRtry, timebuf);
|
||||
timebuf[strlen(timebuf)-1] = '\0'; /* strip LF */
|
||||
errmsg.LogMsg(0, RS_RET_SUSPENDED, LOG_WARNING,
|
||||
LogMsg(0, RS_RET_SUSPENDED, LOG_WARNING,
|
||||
"action '%s' suspended (module '%s'), next retry is %s, retry nbr %d. "
|
||||
"There should be messages before this one giving the reason for suspension.",
|
||||
pThis->pszName, pThis->pMod->pszName, timebuf,
|
||||
@ -785,7 +784,7 @@ actionDoRetry(action_t * const pThis, wti_t * const pWti)
|
||||
DBGPRINTF("actionDoRetry: %s had success RDY again (iRet=%d)\n",
|
||||
pThis->pszName, iRet);
|
||||
if(pThis->bReportSuspension) {
|
||||
errmsg.LogMsg(0, RS_RET_RESUMED, LOG_INFO, "action '%s' "
|
||||
LogMsg(0, RS_RET_RESUMED, LOG_INFO, "action '%s' "
|
||||
"resumed (module '%s')",
|
||||
pThis->pszName, pThis->pMod->pszName);
|
||||
}
|
||||
@ -1570,7 +1569,7 @@ static rsRetVal setActionQueType(void __attribute__((unused)) *pVal, uchar *pszT
|
||||
cs.ActionQueType = QUEUETYPE_DIRECT;
|
||||
DBGPRINTF("action queue type set to DIRECT (no queueing at all)\n");
|
||||
} else {
|
||||
errmsg.LogError(0, RS_RET_INVALID_PARAMS, "unknown actionqueue parameter: %s", (char *) pszType);
|
||||
LogError(0, RS_RET_INVALID_PARAMS, "unknown actionqueue parameter: %s", (char *) pszType);
|
||||
iRet = RS_RET_INVALID_PARAMS;
|
||||
}
|
||||
d_free(pszType); /* no longer needed */
|
||||
@ -1745,9 +1744,9 @@ DEFFUNC_llExecFunc(doActivateActions)
|
||||
BEGINfunc
|
||||
localRet = qqueueStart(pThis->pQueue);
|
||||
if(localRet != RS_RET_OK) {
|
||||
errmsg.LogError(0, localRet, "error starting up action queue");
|
||||
LogError(0, localRet, "error starting up action queue");
|
||||
if(localRet == RS_RET_FILE_PREFIX_MISSING) {
|
||||
errmsg.LogError(0, localRet, "file prefix (work directory?) "
|
||||
LogError(0, localRet, "file prefix (work directory?) "
|
||||
"is missing");
|
||||
}
|
||||
actionDisable(pThis);
|
||||
@ -1935,14 +1934,14 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData,
|
||||
" Could not find template %d '%s' - action disabled",
|
||||
i, pTplName);
|
||||
errno = 0;
|
||||
errmsg.LogError(0, RS_RET_NOT_FOUND, "%s", errMsg);
|
||||
LogError(0, RS_RET_NOT_FOUND, "%s", errMsg);
|
||||
ABORT_FINALIZE(RS_RET_NOT_FOUND);
|
||||
}
|
||||
/* check required template options */
|
||||
if( (iTplOpts & OMSR_RQD_TPL_OPT_SQL)
|
||||
&& (pAction->ppTpl[i]->optFormatEscape == 0)) {
|
||||
errno = 0;
|
||||
errmsg.LogError(0, RS_RET_RQD_TPLOPT_MISSING, "Action disabled. To use this action, you have to specify "
|
||||
LogError(0, RS_RET_RQD_TPLOPT_MISSING, "Action disabled. To use this action, you have to specify "
|
||||
"the SQL or stdSQL option in your template!\n");
|
||||
ABORT_FINALIZE(RS_RET_RQD_TPLOPT_MISSING);
|
||||
}
|
||||
@ -2041,7 +2040,7 @@ actionNewInst(struct nvlst *lst, action_t **ppAction)
|
||||
cnfparamsPrint(&pblk, paramvals);
|
||||
cnfModName = (uchar*)es_str2cstr(paramvals[cnfparamGetIdx(&pblk, ("type"))].val.d.estr, NULL);
|
||||
if((pMod = module.FindWithCnfName(loadConf, cnfModName, eMOD_OUT)) == NULL) {
|
||||
errmsg.LogError(0, RS_RET_MOD_UNKNOWN, "module name '%s' is unknown", cnfModName);
|
||||
LogError(0, RS_RET_MOD_UNKNOWN, "module name '%s' is unknown", cnfModName);
|
||||
ABORT_FINALIZE(RS_RET_MOD_UNKNOWN);
|
||||
}
|
||||
CHKiRet(pMod->mod.om.newActInst(cnfModName, lst, &pModData, &pOMSR));
|
||||
@ -2068,7 +2067,6 @@ rsRetVal actionClassInit(void)
|
||||
CHKiRet(objGetObjInterface(&obj)); /* this provides the root pointer for all other queries */
|
||||
CHKiRet(objUse(datetime, CORE_COMPONENT));
|
||||
CHKiRet(objUse(module, CORE_COMPONENT));
|
||||
CHKiRet(objUse(errmsg, CORE_COMPONENT));
|
||||
CHKiRet(objUse(statsobj, CORE_COMPONENT));
|
||||
CHKiRet(objUse(ruleset, CORE_COMPONENT));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user