How to get the response and request size and log it

Tip: Go thru below documentation which gives all information on how to access on headers.

General information –

One nice way is to download the trace (spend more time in going thru once those trace-<> .xml files ) as you see lot of information & do some fun/good exercise on playing on those variables to understand how to access them..

https://docs.apigee.com/api-platform/reference/variables-reference

To your question you can do js way or assign message way..

sample js way:

var requestMessageSize = context.getVariable(“request.header.Content-Length”);
var targetMessageSize = context.getVariable(“response.header.Content-Length”);

more

var clientReceivedContentLength = context.getVariable(“client.received.content.length”);
var targetReceivedContentLength = context.getVariable(“target.received.content.length”);

Good Luck.