Forum Discussion
Creating JSON content in irule
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 ?
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.
- Guillaume_RoussNimbostratus
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...
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com