need help with a logging policy for timestamps -CLOUD

I’m trying to get the response + request for the total time it takes for each request. i’m using this for a message logging policy on a cloud instance of Apigee Edge. I used a javascript policy to get the variables for timestamps but I keep getting “null” failures

here is my code


var isoSystemTimeStamp = new Date(context.getVariable("client.received.start.timestamp")).toISOString(); 
context.setVariable("loggingIsoSystemTimeStamp", isoSystemTimeStamp);

Hi @Ben Rodriguez, That should work.
Do you see client.received.start.timestamp in the Analytics data recorded?
Where did you attach your policy?

I was testing this against my oauth policy and it itsn’t working. i placed it at the end of the request.

found it

apigee.metrics.policy.JavaScriptSetTotalRequestTime.timeTaken


thanks @Maruti Chand for the push