summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2012-08-11 05:58:15 +0200
committerMiloslav Trmač <mitr@redhat.com>2012-08-28 10:26:42 +0200
commit67039f21b40f711b2462b022b8c508af75ef3dcb (patch)
tree7ed9feabb18844ced920f82ee4921ce76d98f3bd
parent2514bccdccaebe128055ffa0dc5132b4f4c48635 (diff)
downloadrsyslog-67039f21b40f711b2462b022b8c508af75ef3dcb.tar.gz
rsyslog-67039f21b40f711b2462b022b8c508af75ef3dcb.tar.xz
rsyslog-67039f21b40f711b2462b022b8c508af75ef3dcb.zip
Add OMSR_TPL_AS_FIELDS mode for output modules.
This does not yet do anything. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
-rw-r--r--action.c6
-rw-r--r--action.h2
-rw-r--r--doc/dev_oplugins.html3
-rw-r--r--runtime/objomsr.c3
-rw-r--r--runtime/objomsr.h7
5 files changed, 16 insertions, 5 deletions
diff --git a/action.c b/action.c
index 344bdc26..d1dcad89 100644
--- a/action.c
+++ b/action.c
@@ -823,6 +823,9 @@ static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem)
case ACT_MSG_PASSING:
pElem->staticActParams[i] = (void*) pMsg;
break;
+ case ACT_FIELDS_PASSING:
+ pElem->staticActParams[i] = "";
+ break;
default:dbgprintf("software bug/error: unknown pAction->eParamPassing %d in prepareDoActionParams\n",
(int) pAction->eParamPassing);
assert(0); /* software bug if this happens! */
@@ -874,6 +877,7 @@ static rsRetVal releaseBatch(action_t *pAction, batch_t *pBatch)
break;
case ACT_STRING_PASSING:
case ACT_MSG_PASSING:
+ case ACT_FIELDS_PASSING:
/* nothing to do in that case */
/* TODO ... and yet we do something ;) This is considered not
* really needed, but I was not bold enough to remove that while
@@ -1933,6 +1937,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_FIELDS) {
+ pAction->eParamPassing = ACT_FIELDS_PASSING;
} else {
pAction->eParamPassing = ACT_STRING_PASSING;
}
diff --git a/action.h b/action.h
index 66ceaae5..2fb527f1 100644
--- a/action.h
+++ b/action.h
@@ -74,7 +74,7 @@ struct action_s {
int f_repeatcount; /* number of "repeated" msgs */
rsRetVal (*submitToActQ)(action_t *, batch_t *);/* function submit message to action queue */
rsRetVal (*qConstruct)(struct queue_s *pThis);
- enum { ACT_STRING_PASSING = 0, ACT_ARRAY_PASSING = 1, ACT_MSG_PASSING }
+ enum { ACT_STRING_PASSING = 0, ACT_ARRAY_PASSING = 1, ACT_MSG_PASSING, ACT_FIELDS_PASSING }
eParamPassing; /* mode of parameter passing to action */
int iNumTpls; /* number of array entries for template element below */
struct template **ppTpl;/* array of template to use - strings must be passed to doAction
diff --git a/doc/dev_oplugins.html b/doc/dev_oplugins.html
index 63c186a3..10cdfd1b 100644
--- a/doc/dev_oplugins.html
+++ b/doc/dev_oplugins.html
@@ -143,6 +143,9 @@ omstdout, you can see how a plugin may deal with the situation.
array-passing capability not blindly be used.</b> In such cases, we can not guard the
plugin from segfaulting and if the plugin (as currently always) is run within
rsyslog's process space, that results in a segfault for rsyslog. So do not do this.
+<p>Another possible mode is OMSR_TPL_AS_FIELDS, when the textual content of the
+template is ignored, and a list of name-value pairs (with user-supplied flags)
+is passed to the module.
<h3>Batching of Messages</h3>
<p>Starting with rsyslog 4.3.x, batching of output messages is supported. Previously, only
a single-message interface was supported.
diff --git a/runtime/objomsr.c b/runtime/objomsr.c
index 7241fa27..b95fc219 100644
--- a/runtime/objomsr.c
+++ b/runtime/objomsr.c
@@ -149,7 +149,8 @@ OMSRgetSupportedTplOpts(unsigned long *pOpts)
{
DEFiRet;
assert(pOpts != NULL);
- *pOpts = OMSR_RQD_TPL_OPT_SQL | OMSR_TPL_AS_ARRAY | OMSR_TPL_AS_MSG;
+ *pOpts = (OMSR_RQD_TPL_OPT_SQL | OMSR_TPL_AS_ARRAY | OMSR_TPL_AS_MSG
+ | OMSR_TPL_AS_FIELDS);
RETiRet;
}
diff --git a/runtime/objomsr.h b/runtime/objomsr.h
index 643e02c5..912ac0ae 100644
--- a/runtime/objomsr.h
+++ b/runtime/objomsr.h
@@ -25,12 +25,13 @@
/* define flags for required template options */
#define OMSR_NO_RQD_TPL_OPTS 0
#define OMSR_RQD_TPL_OPT_SQL 1
-/* only one of OMSR_TPL_AS_ARRAY or _AS_MSG must be specified, if both are given
- * results are unpredictable.
+/* only one of OMSR_TPL_AS_ARRAY, _AS_MSG or _AS_FIELDS must be specified, if
+ * both are given results are unpredictable.
*/
#define OMSR_TPL_AS_ARRAY 2 /* introduced in 4.1.6, 2009-04-03 */
#define OMSR_TPL_AS_MSG 4 /* introduced in 5.3.4, 2009-11-02 */
-/* next option is 8, 16, 32, ... */
+#define OMSR_TPL_AS_FIELDS 8 /* introduced in 6.3.13, 2012-08-11 */
+/* next option is 16, 32, ... */
struct omodStringRequest_s { /* strings requested by output module for doAction() */
int iNumEntries; /* number of array entries for data elements below */