# How to match two logs in Kibana

**URL:** <https://discuss.elastic.co/t/how-to-match-two-logs-in-kibana/200460>\
**Category:** Kibana\
**Created:** [September 20, 2019, 4:25pm UTC](https://discuss.elastic.co/t/how-to-match-two-logs-in-kibana/200460 "2019-09-20T16:25:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dani\_Ruse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dani_ruse/32/54602_2.png) [@Dani\_Ruse](https://discuss.elastic.co/u/Dani_Ruse)\
**Post date:** [September 20, 2019, 4:25pm UTC](https://discuss.elastic.co/t/how-to-match-two-logs-in-kibana/200460/1 "2019-09-20T16:25:25Z")

</div>

Hello!

I have in Kibana some logs with the following message formats: "Process started with id 5" and "Process ended with id 5".

What I want is to match the two logs based on the id found in the message field and then compute the difference between their two timestamps.

I tried to use a scripted field, but I get a compilation error and Kibana doesn't show me the error message.

How can I manage to match two logs and access their contents?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [September 20, 2019, 8:53pm UTC](https://discuss.elastic.co/t/how-to-match-two-logs-in-kibana/200460/2 "2019-09-20T20:53:58Z")

</div>

How are you ingesting your logs? I suggest parsing your message and extracting the id from the message at ingest time. With Logstash you can use the [dissect filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html) to do this. With Beats you can use the [dissect ingest processor](https://www.elastic.co/guide/en/elasticsearch/reference/current/dissect-processor.html).

Getting the elapsed time between logs is also easier to do at ingest time. Logstash has an [elapsed filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elapsed.html) which helps with this.

---

<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:** [October 18, 2019, 8:54pm UTC](https://discuss.elastic.co/t/how-to-match-two-logs-in-kibana/200460/3 "2019-10-18T20:54:05Z")

</div>

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