# Timestamps difference

**URL:** <https://discuss.elastic.co/t/timestamps-difference/122083>\
**Category:** Kibana\
**Created:** [March 1, 2018, 1:56pm UTC](https://discuss.elastic.co/t/timestamps-difference/122083 "2018-03-01T13:56:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arun3](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@arun3](https://discuss.elastic.co/u/arun3)\
**Post date:** [March 1, 2018, 1:56pm UTC](https://discuss.elastic.co/t/timestamps-difference/122083/1 "2018-03-01T13:56:16Z")

</div>

Hi- I want to group my logs as per a particular fieldValue and then find the difference of timestamps between First and Last occurrence.

How to approach this ? suggestions invited.

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [March 2, 2018, 1:19am UTC](https://discuss.elastic.co/t/timestamps-difference/122083/2 "2018-03-02T01:19:12Z")

</div>

Unfortunately you would need a scripted metric aggregation which Kibana doesn't support yet, we're tracking it at [https://github.com/elastic/kibana/issues/2646](https://github.com/elastic/kibana/issues/2646). You could output the first and last occurrence using the top hits aggregation.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 30, 2018, 1:19am UTC](https://discuss.elastic.co/t/timestamps-difference/122083/3 "2018-03-30T01:19:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
