# Difference in timestamp between 2 logs of same ID

**URL:** https://discuss.elastic.co/t/difference-in-timestamp-between-2-logs-of-same-id/196082
**Category:** Kibana
**Created:** [August 21, 2019, 10:08am UTC](https://discuss.elastic.co/t/difference-in-timestamp-between-2-logs-of-same-id/196082 "2019-08-21T10:08:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ram\_Prasad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_prasad/32/52699_2.png) [@Ram\_Prasad](https://discuss.elastic.co/u/Ram_Prasad)
#### Post date: [August 21, 2019, 10:08am UTC](https://discuss.elastic.co/t/difference-in-timestamp-between-2-logs-of-same-id/196082/1 "2019-08-21T10:08:06Z")

</div>

I have a set of logs which has the timestamp as attribute with a same ID for a particular transaction in kibana. I need to get the difference between the timestamps of the first log and the last log of the transaction. Can anyone help me with it ?

---

<div class="post-metadata">

### Author: ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)
#### Post date: [August 21, 2019, 8:49pm UTC](https://discuss.elastic.co/t/difference-in-timestamp-between-2-logs-of-same-id/196082/2 "2019-08-21T20:49:42Z")

</div>

Hi, I think you can get what you are looking for with Scripted Fields in Kibana. It is possible to add a new field to the data that comes from computing of other fields in a document. There's a good blog post [here](https://www.elastic.co/blog/using-painless-kibana-scripted-fields) which includes some examples of working with dates, and other great Painless tips.

---

<div class="post-metadata">

### Author: ![Ram\_Prasad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ram_prasad/32/52699_2.png) [@Ram\_Prasad](https://discuss.elastic.co/u/Ram_Prasad)
#### Post date: [August 22, 2019, 7:12am UTC](https://discuss.elastic.co/t/difference-in-timestamp-between-2-logs-of-same-id/196082/3 "2019-08-22T07:12:50Z")

</div>

Thanks Tim ! Will take a look into it

---

<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: [September 19, 2019, 7:24am UTC](https://discuss.elastic.co/t/difference-in-timestamp-between-2-logs-of-same-id/196082/4 "2019-09-19T07:24:06Z")

</div>

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