Syslog-ng how to escape all data inside ${MESSAGE}, i need to send it to http endpoint as json

53 Views Asked by At

i need to send all received syslog message as an json payload.

syslog entry it self contains double quotes and other special chars, that ruins my json payload, any idea how it can automatically escape those ?

That's the current configuration that i tried

destination httpendpoint {
  http(
    url("https://webhook-tester/somethinsomethin")
    method("POST")
    tls(
      peer-verify(yes)
      ca-dir("/etc/ssl/certs")
    )
    body("{ \"source\": \"TCPSyslog\", \"host\": \"${PROXIED_SRCIP}\", \"message\": \"${MESSAGE}\"}")
  );
};
0

There are 0 best solutions below