The request/response is not saved by default. In some cases, it's required to save the request/response for certain purposes, such as debugging, auditing, etc.
There are a few ways to save requests/responses, by using the "Audit Messages in Policy" assertion and selecting Always save request/response, or using the "Add Audit Detail" assertion to save ${request.mainpart}/${response.mainpart}.
All supported versions of the API Gateway
Here is an example of how to configure a traffic log sink to save a request/response to a log file.
1. Add a new log sink for the traffic log:
2. Add the trafficlogger.detail cluster-wide property to specify the output of the traffic log:
NOTE 1: If the ${response.mainpart} is not set due to an exception in the service policy, the response body will be empty. ie. the traffic log may not be able to save default/custom error response.
NOTE 2: The new log file can be found under folder /opt/SecureSpan/Gateway/node/default/var/logs
NOTE 3: The traffic log output can be customized in cluster-wide property trafficlogger.detail. The above is just an example - the format can be modified with more context variables.
The output of the above setting may look like,
2018-09-12T14:45:46.785+1000 INFO 19912 com.l7tech.traffic: traffic log -- start
request url --
http://<gateway host>:8080/testonly
request body --
here is request body
response body --
ok, this is response
traffic log -- end