diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-16 08:21:12 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-16 08:21:12 +0100 |
commit | 62b7a1b8a828446aa75ac138333a4fa019898fb1 (patch) | |
tree | 59f7c4383610fa896ce2f1946bf2b2463a65213a /template.c | |
parent | 66ab2a70e5bcc9637dfec89c6134abe10b96dde8 (diff) | |
download | rsyslog-62b7a1b8a828446aa75ac138333a4fa019898fb1.tar.gz rsyslog-62b7a1b8a828446aa75ac138333a4fa019898fb1.tar.xz rsyslog-62b7a1b8a828446aa75ac138333a4fa019898fb1.zip |
added "json" property replacer option
Diffstat (limited to 'template.c')
-rw-r--r-- | template.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -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] "); } |