MessageLogging to Loggly

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

@Mike Ison

Solved Solved
0 7 960
2 ACCEPTED SOLUTIONS

@paulmartin ,

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,

2048-screen-shot-2016-02-25-at-110059-am.png

2049-screen-shot-2016-02-25-at-110126-am.png

We will keep you posted on fix, till the time please use above workaround. Keep us posted if you have any queries.

View solution in original post

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>

View solution in original post

7 REPLIES 7

@paulmartin ,

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,

2048-screen-shot-2016-02-25-at-110059-am.png

2049-screen-shot-2016-02-25-at-110126-am.png

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

@Anil Sagar

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>

2051-screen-shot-2016-02-25-at-75058-pm.png

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 ?