Hi Juha,
The only question I can think of adding at this point is are you doing an initial parse in the API? If not and your request is streamed, I'm thinking your request.body is not in context so the log action with gather only has no request to gather and your redact has nothing to work on, then the request_body is added when the gateway sees no request_body in the analytics record. Is your issue only with redaction of request_body and not with redaction of response_body? If you are doing the parse up front, I'd suggest you open a PMR to have this investigated further.
Best Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Fri February 02, 2024 03:39 AM
From: Juha Mikkonen
Subject: Redaction on API Connect v10 for SOAP/XML payload
Hello Steve,
The simililar xpath works fine in API Connect v5.
- Yes, I am using in log policy gather-only mode
- We have deployed API Connect version 10.0.5.3 and Gateway version is 10.5.0.9 and Log policy and redact transformation is added to finally clause.
I need to investigate this more.
Juha
------------------------------
Juha Mikkonen
------------------------------
Original Message:
Sent: Thu January 04, 2024 03:57 PM
From: Steve Linn
Subject: Redaction on API Connect v10 for SOAP/XML payload
Hi Juha,
Since you're redact path is using the JSONata $xpath function, you are using a redact 2.0.0 or later version policy. The XPath's specified look fine to me.
A couple questions and comments:
1. Do you proceed your redact policy with a log policy with a type of gather-only? When doing a redact 2.x policy, the logs.request|response_body are added to the API context when the log policy with gather-only is executed. If you are not doing that, then the log data doesn't exist at the time of your redact policy execution so nothing is redacted, but the log data will be added implicitly with the un-redacted bodies after the assembly completes and a log policy has not been executed.
2. What version of DataPower do you have deployed? Hopefully you're using 10.5.x.y as this version supports the finally clause. Version 10.0.1.x does not have the finally clause which makes the use of the redact 2.0.0 policy difficult. That is because any failure in the API that causes the assembly to fail before the redact policy will mean there will be no redaction. You could of course then duplicate the log and redact policies at the end of every catch you have, and if you don't have a catch or do have a catch but not a default catch, you'd need to add a default catch that would do the log and redact policies and then rethrow the error. Needless to say it was somewhat cumbersome in that version which is why the finally clause was added. If using 10.5.x.y then the log and redact policy should be specified in the finally clause. This way they're specified only in one place and will be guaranteed to execute regardless of an error in the assembly rule or a catch rule.
Best Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM