From 62b7a1b8a828446aa75ac138333a4fa019898fb1 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 16 Mar 2012 08:21:12 +0100 Subject: added "json" property replacer option --- template.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'template.c') diff --git a/template.c b/template.c index ca1688f7..bcdcc367 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] "); } -- cgit