I originally added this as an answer to another similar question on this topic, but decided it was probably better to put in it’s own question…
I need to send logs to an ELK stack within my corporate back-end. I am hitting a RESTful endpoint via HTTP. But I found the MessageLogging policy very limiting in terms of the material I wanted to log and how I wanted to structure the payload.
I have built a log payload through JavaScript, which works well and contains a wealth of information in the structure I need it… but it means I can’t put it in the ClientPostFlow, as it doesn’t appear you can execute scripts in this flow.
So I have put it in the Response PostFlow instead. I have bundled the JS step and a Service Callout into a Shared Flow, and set the whole lot on “Continue on Error”. OK so far…
But… Even with the Service Callout running asynchronously, the average proxy response time has jumped from an average of 15ms to an average of 60ms. When you look at the Trace, it’s difficult to see where this extra overhead has come from.
If you take this Trace above, it shows the JS step taking < 1ms, and the SC step taking < 1ms. The overall Flow Callout is taking < 1ms. BUT… the “Response Sent to Client” overall is showing an elapsed time of 58ms. That doesn’t seem to tally-up with the response times of each of the steps within the flow.
I guess there’s a few questions here:
- Any idea where my overhead is coming from, or how I figure it out?
- Is there any plan to allow scripting in the ClientPostFlow, as I know this is the best place to put the logging?
- Would I gain any benefit from building my payload in Javascript, but then using a MessageLogging policy rather than a Service Callout policy to actually make the call? Does Message Logging do anything particularly ‘clever’ that Service Callout doesn’t do?
