How to check the previous policy's "action" or "result" properties?

Not applicable

I want to set a condition on a policy so it triggers only if the value for the "action" property for the previous policy was "ABORT" or the "result" for the previous property was "false". The intention is to use this as part of logging for traffic management policies that although enabled are set to allow to continue on error. The goal is to log if they get triggered which so far is only possible if they are allowed to block the requests.

0 3 308
3 REPLIES 3

Not applicable

Hello @gonzalo.silva.cruz,

Have you tried checking the fault.name context variable ?

Not applicable

Thanks for the tip @MEGHDEEP BASU, although I didn't use it as part of my condition, it was good to include on the log I generated. I ended up using a combination of variables triggered by the previous policy that I could see in trace mode. Nonetheless, I still wonder if there is a way to get the values for "action" or "result"

robinm
New Member

At this time, the 'properties' variables as shown in Trace are not exposed in the context.

When you set a policy to ContinueOnError="true":-

  1. Trace shows many of the commonly-used variables are not populated as expected.
  2. You lose any result reasons placed in the message body, such as with a SOAP Message Validation policy.

Taking SpikeArrest as an example, normal FaultRule Conditions would likely be

<Condition>fault.name Matches "SpikeArrestViolation"</Condition>

or

<Condition>ratelimit.Spike-Arrest-1.failed=true</Condition>

With ContinueOneError set, under Trace, the step may be flagged with the exclamation fault icon, but fault.name is not populated and ratelimit.Spike-Arrest-1.failed is shown as 'false'. However, on referencing the variable and on the trace display of the following step ... ratelimit.Spike-Arrest-1.failed is shown as "true".

( There is also another variable ratelimit.failed but this is less specific, because it is also set for a failed quota policy as both use 'ratelimit' as their prefix.)

In short, when using ContinueOnError="true", you should rather check [prefix].[policyname].failed.