Calculate elapsed time in Kibana?

ELK newbie here. Is it possible in Kibana visualization (ie. Table) to calculate the elapsed time from the timestamp and current time? Looking to populate a field in the table to show the elapsed time since the last timestamp received for specific messages.

Thanks!

Hi @TXBigDawg1836 Welcome to the community

Yup add a runtime field to the Data View

here is the code

long datenow = new Date().getTime();
long datewas = doc['@timestamp'].value.getMillis();
emit (datenow - datewas);

Create / Set the Field

Chose your format....

In Discover

Now Table...

1 Like

Stephen,
Thanks for the detailed info. That was exactly what was needed and worked perfectly!