# Time difference calculation between the timestamps

**URL:** <https://discuss.elastic.co/t/time-difference-calculation-between-the-timestamps/32239>\
**Category:** Logstash\
**Created:** [October 15, 2015, 6:40am UTC](https://discuss.elastic.co/t/time-difference-calculation-between-the-timestamps/32239 "2015-10-15T06:40:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Surbhi\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Surbhi\_Agarwal](https://discuss.elastic.co/u/Surbhi_Agarwal)\
**Post date:** [October 15, 2015, 6:40am UTC](https://discuss.elastic.co/t/time-difference-calculation-between-the-timestamps/32239/1 "2015-10-15T06:40:22Z")

</div>

Here comes one use case. Suppose the logs are coming in the logstash but its stop getting logs for some time interval. I want to know this time lag.

For Example :

At certain point of time like at 14:37:46 , i got this log messages.

2015-10-14 14:37:46 TRACE Example 21 NO\_MEMORY!  
2015-10-14 14:37:46 DEBUG Example 22 unable to load for debugging!  
2015-10-14 14:37:46 INFO Example 23 uplaodes successfully!  
2015-10-14 14:37:46 WARN Example 26 permission denied!  
2015-10-14 14:37:46 ERROR Example 27 NullPointerException!  
2015-10-14 14:37:46 FATAL Example 28 NoConnectionPending

Now, after certain time interval like at 14:48:05 , i got another log messages.

2015-10-14 14:48:05 WARN Example 26 permission denied!  
2015-10-14 14:48:05 ERROR Example 27 NullPointerException!  
2015-10-14 14:48:05 FATAL Example 28 NoConnectionPending  
2015-10-14 14:48:05 TRACE Example 21 NO\_MEMORY!  
2015-10-14 14:48:05 DEBUG Example 22 unable to load for debugging!  
2015-10-14 14:48:05 INFO Example 23 uplaodes successfully!  
2015-10-14 14:48:05 WARN Example 26 permission denied!

As one can see from the above logs that there is a time lag between the timestamps.So, i want to calculate this time difference so that in future i could analyze in Kibana and find out the reason why there comes time lag.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 15, 2015, 6:44am UTC](https://discuss.elastic.co/t/time-difference-calculation-between-the-timestamps/32239/2 "2015-10-15T06:44:21Z")

</div>

There's a thread on this here - [Time between timestamp](https://discuss.elastic.co/t/time-between-timestamp/32137)

---

<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 6, 2017, 5:26am UTC](https://discuss.elastic.co/t/time-difference-calculation-between-the-timestamps/32239/3 "2017-07-06T05:26:29Z")

</div>


