summaryrefslogtreecommitdiffstats
path: root/template.h
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2012-08-11 07:30:36 +0200
committerMiloslav Trmač <mitr@redhat.com>2012-08-28 10:26:42 +0200
commit30a43cc865f3d7247ec0356566e57b9252e2e6c1 (patch)
treee76b3d73c2b81c74781c952eb0cb82e8f2288181 /template.h
parent67039f21b40f711b2462b022b8c508af75ef3dcb (diff)
downloadrsyslog-30a43cc865f3d7247ec0356566e57b9252e2e6c1.tar.gz
rsyslog-30a43cc865f3d7247ec0356566e57b9252e2e6c1.tar.xz
rsyslog-30a43cc865f3d7247ec0356566e57b9252e2e6c1.zip
Implement ACT_FIELDS_PASSING, test in mongodb
The mongodb test contains only debug printfs. Example template, inspired by writeMongoDB_msg: $template MongoTemplate,"%hostname::::sys%%timereported::::time%%timegenerated::::time_rcvd%%msg%%syslogfacility-text::::syslog_fac%%syslogseverity-text::::syslog_server%%syslogtag::::syslog_tag%%programname::::procid%%procid::::pid%%$!foo::::foo%%$!abc::::renamed%" Note that JSON escaping is actually undesirable in this mode (should it be silently ignored?), $!all-json doesn't yet work as expected, and all data is stored as strings. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'template.h')
-rw-r--r--template.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/template.h b/template.h
index 9f6a4c33..218f8b27 100644
--- a/template.h
+++ b/template.h
@@ -119,6 +119,13 @@ struct templateEntry {
} data;
};
+/* A field in a list returned by OMSR_TPL_AS_FIELDS / ACT_FIELDS_PASSING.
+ Terminated by an entry with NULL fieldName. */
+struct templateField {
+ es_str_t *fieldName; /* Borrowed reference, do not free! */
+ uchar *value; /* For free() */
+};
+
/* interfaces */
BEGINinterface(tpl) /* name must also be changed in ENDinterface macro! */
@@ -144,6 +151,7 @@ rsRetVal ExtendBuf(uchar **pBuf, size_t *pLenBuf, size_t iMinSize);
* rgerhards, 2007-08-06
*/
rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr);
+rsRetVal tplToFields(struct template *pTpl, msg_t *pMsg, struct templateField **pFields);
rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar** ppSz, size_t *);
rsRetVal doEscape(uchar **pp, size_t *pLen, unsigned short *pbMustBeFreed, int escapeMode);