summaryrefslogtreecommitdiffstats
path: root/template.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-03-16 08:21:12 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2012-03-16 08:21:12 +0100
commit62b7a1b8a828446aa75ac138333a4fa019898fb1 (patch)
tree59f7c4383610fa896ce2f1946bf2b2463a65213a /template.c
parent66ab2a70e5bcc9637dfec89c6134abe10b96dde8 (diff)
downloadrsyslog-62b7a1b8a828446aa75ac138333a4fa019898fb1.zip
rsyslog-62b7a1b8a828446aa75ac138333a4fa019898fb1.tar.gz
rsyslog-62b7a1b8a828446aa75ac138333a4fa019898fb1.tar.xz
added "json" property replacer option
Diffstat (limited to 'template.c')
-rw-r--r--template.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/template.c b/template.c
index ca1688f..bcdcc36 100644
--- a/template.c
+++ b/template.c
@@ -542,7 +542,19 @@ static void doOptions(unsigned char **pp, struct templateEntry *pTpe)
} else if(!strcmp((char*)Buf, "secpath-replace")) {
pTpe->data.field.options.bSecPathReplace = 1;
} else if(!strcmp((char*)Buf, "csv")) {
- pTpe->data.field.options.bCSV = 1;
+ if(pTpe->data.field.options.bJSON) {
+ errmsg.LogError(0, NO_ERRCODE, "error: can not specify "
+ "both csv and json options - csv ignored");
+ } else {
+ pTpe->data.field.options.bCSV = 1;
+ }
+ } else if(!strcmp((char*)Buf, "json")) {
+ if(pTpe->data.field.options.bCSV) {
+ errmsg.LogError(0, NO_ERRCODE, "error: can not specify "
+ "both csv and json options - json ignored");
+ } else {
+ pTpe->data.field.options.bJSON = 1;
+ }
} else {
dbgprintf("Invalid field option '%s' specified - ignored.\n", Buf);
}
@@ -1280,6 +1292,9 @@ void tplPrintList(rsconf_t *conf)
if(pTpe->data.field.options.bCSV) {
dbgprintf("[format as CSV (RFC4180)]");
}
+ if(pTpe->data.field.options.bJSON) {
+ dbgprintf("[format as JSON");
+ }
if(pTpe->data.field.options.bDropLastLF) {
dbgprintf("[drop last LF in msg] ");
}