I am trying to use MessageLogging policy to Loggly. If I log response.content in the proxy PostFlow it works, but if I put the policy in the proxy PostClientFlow the response.content isn't available. Please help.
Thanks
Paul
Solved! Go to Solution.
Good catch & Thank you for reporting same. I can able to reproduce issue. Seems like a bug.
Till the time issue is fixed, You can use a work around by setting up a custom variable using javascript & using same while message logging. I have verified same & it works.
In Javascript Policy, Post Flow Response,
context.setVariable('logResponse', context.getVariable("message.content"))
Message logging policy, In Post Client Flow Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MessageLogging name="LogToSyslog"> <Syslog> <Message>[XXXXXXXXXXX@41058 tag="{organization.name}.{apiproxy.name}.{environment.name}"] Weather request for WOEID {logResponse}.</Message> <Host>logs-01.loggly.com</Host> <Port>514</Port> <Protocol>TCP</Protocol> </Syslog> </MessageLogging>
Results,
We will keep you posted on fix, till the time please use above workaround. Keep us posted if you have any queries.
Your work around worked with the caveat that I had to place the following property in the HTTPTargetConnections or else 400 and 500 errors will enter the error flow and the logResponse variable won't be set.
<Properties>
<Property name="success.codes">1xx,2xx,3xx,4xx,5xx</Property>
</Properties>
Good catch & Thank you for reporting same. I can able to reproduce issue. Seems like a bug.
Till the time issue is fixed, You can use a work around by setting up a custom variable using javascript & using same while message logging. I have verified same & it works.
In Javascript Policy, Post Flow Response,
context.setVariable('logResponse', context.getVariable("message.content"))
Message logging policy, In Post Client Flow Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MessageLogging name="LogToSyslog"> <Syslog> <Message>[XXXXXXXXXXX@41058 tag="{organization.name}.{apiproxy.name}.{environment.name}"] Weather request for WOEID {logResponse}.</Message> <Host>logs-01.loggly.com</Host> <Port>514</Port> <Protocol>TCP</Protocol> </Syslog> </MessageLogging>
Results,
We will keep you posted on fix, till the time please use above workaround. Keep us posted if you have any queries.
Thanks for the work around
Do we know by when the above issue ( message.content being blank in PostClientFlow) will be fixed? we are using On premise version.
Your work around worked with the caveat that I had to place the following property in the HTTPTargetConnections or else 400 and 500 errors will enter the error flow and the logResponse variable won't be set.
<Properties>
<Property name="success.codes">1xx,2xx,3xx,4xx,5xx</Property>
</Properties>
@paulmartin , We can improve above solution using fault rules instead of changing success criteria which will affect analytics reports.
Execute same Javascript using default fault rule in target end point to set logResponse variable.
<DefaultFaultRule name="fault-rule"> <Step> <Name>JavaScript-3</Name> </Step> </DefaultFaultRule>
I like this approach better. Thanks for the improvement.
For me this doesn't work.
,Hi, for me this doesn't work. Has something changed ?
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |