# Subtract @timestamp between two events in Visualize on kibana

**URL:** https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479
**Category:** Kibana
**Created:** [August 4, 2021, 10:48pm UTC](https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479 "2021-08-04T22:48:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Adixon\_Diaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adixon_diaz/32/91182_2.png) [@Adixon\_Diaz](https://discuss.elastic.co/u/Adixon_Diaz)
#### Post date: [August 4, 2021, 10:48pm UTC](https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479/1 "2021-08-04T22:48:57Z")

</div>

Hi Elastic Team,

I want to be able to subtract the field @timestamp for two events. For exmample, i recieve 1 event by second, so, i would like to subtract the last event to arrive against the penultimate event to arrive.

How can i do this?

Thanks

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [August 5, 2021, 2:53am UTC](https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479/2 "2021-08-05T02:53:34Z")

</div>

Hello,

You can definitely use runtime fields or scripted fields to do it. But there might be other ways of getting the same data to look at. How were you planning to visualize this data?

> **[Runtime fields | Elasticsearch Guide \[master\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/master/runtime.html)**

Thanks  
Bhavya

---

<div class="post-metadata">

### Author: ![Adixon\_Diaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adixon_diaz/32/91182_2.png) [@Adixon\_Diaz](https://discuss.elastic.co/u/Adixon_Diaz)
#### Post date: [August 5, 2021, 12:24pm UTC](https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479/3 "2021-08-05T12:24:15Z")

</div>

Hi bhavyram, i apreciate your answer,

I planning to show a gauge with ranges. My target is show how many transaction are above to 10seg for example.

1 transaction is two events that i identify by my log logic, so, i want to subtract those events.

---

<div class="post-metadata">

### Author: ![Adixon\_Diaz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adixon_diaz/32/91182_2.png) [@Adixon\_Diaz](https://discuss.elastic.co/u/Adixon_Diaz)
#### Post date: [August 5, 2021, 7:44pm UTC](https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479/4 "2021-08-05T19:44:26Z")

</div>

Hi, Elatic team, @bhavyarm i apreciate if you give me an example how can i use the runtime fields. I had seen a lot of information, but i don't understand. I mean, we can create a runtime fields into a index, but i really don't understand the better how can i start.

If you can bring me some information will be great.

Thanks

---

<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 2, 2021, 7:45pm UTC](https://discuss.elastic.co/t/subtract-timestamp-between-two-events-in-visualize-on-kibana/280479/5 "2021-09-02T19:45:19Z")

</div>

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