diff options
author | Miloslav Trmač <mitr@redhat.com> | 2012-08-11 07:30:36 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2012-08-28 10:26:42 +0200 |
commit | 30a43cc865f3d7247ec0356566e57b9252e2e6c1 (patch) | |
tree | e76b3d73c2b81c74781c952eb0cb82e8f2288181 /template.h | |
parent | 67039f21b40f711b2462b022b8c508af75ef3dcb (diff) | |
download | rsyslog-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.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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); |