diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-10-22 11:41:23 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-10-22 11:41:23 +0200 |
commit | 163acd9d9fd5e01975e99ad26af8a9c8097b3260 (patch) | |
tree | d5901dfca0f2e38ddcf8b973086343ab23a866a1 /action.c | |
parent | bee73d2d93105b187171a1cc51ecf4125b39b65d (diff) | |
parent | 82d0b37dc86385cd239b03da1e57eaba88720589 (diff) | |
download | rsyslog-163acd9d9fd5e01975e99ad26af8a9c8097b3260.tar.gz rsyslog-163acd9d9fd5e01975e99ad26af8a9c8097b3260.tar.bz2 rsyslog-163acd9d9fd5e01975e99ad26af8a9c8097b3260.zip |
Merge branch 'v6-beta' into v6-stable
Diffstat (limited to 'action.c')
-rw-r--r-- | action.c | 29 |
1 files changed, 17 insertions, 12 deletions
@@ -98,6 +98,7 @@ #include <strings.h> #include <time.h> #include <errno.h> +#include <json/json.h> #include "dirty.h" #include "template.h" @@ -262,7 +263,7 @@ actionResetQueueParams(void) cs.bActionQSyncQeueFiles = 0; cs.iActionQtoQShutdown = 0; /* queue shutdown */ cs.iActionQtoActShutdown = 1000; /* action shutdown (in phase 2) */ - cs.iActionQtoEnq = 2000; /* timeout for queue enque */ + cs.iActionQtoEnq = 50; /* timeout for queue enque */ cs.iActionQtoWrkShutdown = 60000; /* timeout for worker thread shutdown */ cs.iActionQWrkMinMsgs = 100; /* minimum messages per worker needed to start a new one */ cs.bActionQSaveOnShutdown = 1; /* save queue on shutdown (when DA enabled)? */ @@ -803,6 +804,7 @@ static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem) { int i; msg_t *pMsg; + struct json_object *json; DEFiRet; ASSERT(pAction != NULL); @@ -823,6 +825,10 @@ static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem) case ACT_MSG_PASSING: pElem->staticActParams[i] = (void*) pMsg; break; + case ACT_JSON_PASSING: + CHKiRet(tplToJSON(pAction->ppTpl[i], pMsg, &json)); + pElem->staticActParams[i] = (void*) json; + break; default:dbgprintf("software bug/error: unknown pAction->eParamPassing %d in prepareDoActionParams\n", (int) pAction->eParamPassing); assert(0); /* software bug if this happens! */ @@ -885,6 +891,13 @@ static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch) ((uchar**)pElem->staticActParams)[j] = NULL; } break; + case ACT_JSON_PASSING: + for(j = 0 ; j < pAction->iNumTpls ; ++j) { + json_object_put((struct json_object*) + pElem->staticActParams[j]); + pElem->staticActParams[j] = NULL; + } + break; } } } @@ -1094,16 +1107,6 @@ finalize_it: RETiRet; } -/* debug aid */ -static void displayBatchState(batch_t *pBatch) -{ - int i; - for(i = 0 ; i < pBatch->nElem ; ++i) { - dbgprintf("XXXXX: displayBatchState2 %p[%d]: %d\n", pBatch, i, pBatch->pElem[i].state); - } -} - - /* submit a batch for actual action processing. * The first nElem elements are processed. This function calls itself * recursively if it needs to handle errors. @@ -1948,6 +1951,8 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, pAction->eParamPassing = ACT_ARRAY_PASSING; } else if(iTplOpts & OMSR_TPL_AS_MSG) { pAction->eParamPassing = ACT_MSG_PASSING; + } else if(iTplOpts & OMSR_TPL_AS_JSON) { + pAction->eParamPassing = ACT_JSON_PASSING; } else { pAction->eParamPassing = ACT_STRING_PASSING; } @@ -2086,7 +2091,7 @@ finalize_it: * rgerhards, 2011-07-19 */ rsRetVal -actionProcessCnf(struct cnfobj *o) +actionProcessCnf(struct cnfobj __attribute__((unused)) *o) { DEFiRet; #if 0 /* we need to check if we actually need this functionality -- later! */ |