19-Aug-2020
00:51
- last edited on
04-Jun-2023
21:19
by
JimmyPackets
Hello.
I'm using an irule to send traffic logs to a remote syslog server, using JSON format. Currently I'm creating JSON content manually, using format function, ie:
set message [format {{ "key1":"%s", "key2":"%s", ... }} $value1 $value2 ... ]
HSL::send $hsl $message
However, this is a bit painful, especially as the number of key/value pairs rise, and doesn't handle internal escaping of characters inside values. Is there a better way to create JSON content in irule ?
23-Aug-2020 01:58
Hello Guillaume.
You could use a request-logging and set a JSON format in the request-logging template.
https://support.f5.com/csp/article/K00847516
Regards,
Dario.
24-Aug-2020 08:59
Hello Dario, thanks for the suggestion. Unfortunately, this will only work for HTTP traffic, whereas I have other kind of traffic to report, such as SMTP, IMAP, POP, etc...