Calculating duration from two dates

We post log information from an application to the Log API in New Relic. Within that data are two fields - a start and end time for the event/log/transaction we are interested in capturing.

For example, inside the payload is
“StartTime”: “2018-11-26T14:37:25.433Z”,
“EndTime”: “2018-11-26T14:37:26.2861846Z”

This fires at the end of every completed transaction/job. We are hoping to figure out the duration from this so that we can record how much time each transaction has taken and cumulatively how much time it has taken too.

The payload is fixed so I can’t manipulate it before it arrives in New Relic.

Is there a way to do this?

Hi @EmBee

Welcome to the community!

Check out this link, it may cover your needs:
https://docs.newrelic.com/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#cohort-analysis