Search code examples
syslog-ng

syslog-ng replacing double quotation with single quotation in MESSAGE


In syslog-ng I am using particular template for formatting message format. Following is the template I am using

template t_noHeader {
    template("{\"time\":\"$DATE\",\"logLevel\":\"$LEVEL\",\"log\":{[\"$PROGRAM\",\"$MSG\"]}}\n");
    template_escape(no);
};

$MSG can sometimes contain "" which I want to replace with single quotation mark. Is it possible to do this in syslog-ng.conf file.


Solution

  • Try the replace-delimiter template function: https://syslog-ng.com/documents/html/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/reference-template-functions.html#template-function-replace-delimiter