# Compute difference between 2 timestamps

**URL:** <https://discuss.elastic.co/t/compute-difference-between-2-timestamps/89276>\
**Category:** Logstash\
**Created:** [June 13, 2017, 10:46pm UTC](https://discuss.elastic.co/t/compute-difference-between-2-timestamps/89276 "2017-06-13T22:46:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahimsharaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibrahimsharaf/32/17304_2.png) [@ibrahimsharaf](https://discuss.elastic.co/u/ibrahimsharaf)\
**Post date:** [June 13, 2017, 10:46pm UTC](https://discuss.elastic.co/t/compute-difference-between-2-timestamps/89276/1 "2017-06-13T22:46:57Z")

</div>

Hello, I want to calculate time elapsed between the start and end of a logfile, if I extract the timestamp for every line, can I calculate the min and max (or first and last) ones, and get the difference between them?  
for example:

> start: 2017-05-01 07:41:25  
> end: 2017-05-01 10:14:34  
> output: 02:33:09

Is this doable in logstash?

---

<div class="post-metadata">

**Author:** ![Kryten](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@Kryten](https://discuss.elastic.co/u/Kryten)\
**Post date:** [June 14, 2017, 7:16am UTC](https://discuss.elastic.co/t/compute-difference-between-2-timestamps/89276/2 "2017-06-14T07:16:28Z")

</div>

Might we worth taking a look at the elapsed filter:  
[https://www.elastic.co/guide/en/logstash/current/plugins-filters-elapsed.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elapsed.html)

---

<div class="post-metadata">

**Author:** ![ibrahimsharaf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibrahimsharaf/32/17304_2.png) [@ibrahimsharaf](https://discuss.elastic.co/u/ibrahimsharaf)\
**Post date:** [June 14, 2017, 10:45am UTC](https://discuss.elastic.co/t/compute-difference-between-2-timestamps/89276/3 "2017-06-14T10:45:02Z")

</div>

Thanks @Kryten, will take a look.

---

<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:** [July 12, 2017, 10:45am UTC](https://discuss.elastic.co/t/compute-difference-between-2-timestamps/89276/4 "2017-07-12T10:45:23Z")

</div>

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