# How to correlate two log files based on a UNIQUE key:value pair?

**URL:** https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966
**Category:** Kibana
**Created:** [May 29, 2020, 6:01pm UTC](https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966 "2020-05-29T18:01:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![marco2005](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@marco2005](https://discuss.elastic.co/u/marco2005)
#### Post date: [May 29, 2020, 6:01pm UTC](https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966/1 "2020-05-29T18:01:50Z")

</div>

I have two log files. In one log file there are 3 fields after it is split over and it gets showed up in Kibana.  
LogA

- mobile
- eid
- access\_time

And this is another file with 10 fields:  
LogB

- mobile
- card
- token
- vehicle
- .
- .and so on

So, what I want is, if I search in Kibana wit mobile=123, then I should show all the fields from both the log files or lets say I am interested only in some fields from both the log files. Is this possible to achieve in Kibana ?

---

<div class="post-metadata">

### Author: ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)
#### Post date: [June 4, 2020, 8:21am UTC](https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966/2 "2020-06-04T08:21:15Z")

</div>

Hi @marco2005  
Yes it's possible, you can create an index-pattern in Kibana that cover both indices `LogA` and `LogB` for example: `Log*`  
Then on Discover you can select that index-patten and query using your `mobile` field. It will show logs that match both indices. You can also select the column you want to visualize on the `Available fields` column on the right side.

Please checkout this link for an overview of the steps: [https://www.elastic.co/guide/en/kibana/current/discover.html](https://www.elastic.co/guide/en/kibana/current/discover.html)

---

<div class="post-metadata">

### Author: ![marco2005](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@marco2005](https://discuss.elastic.co/u/marco2005)
#### Post date: [June 4, 2020, 10:33am UTC](https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966/3 "2020-06-04T10:33:48Z")

</div>

Unfortunately that doesn't work.  
In Index patterns , I see 4 fields now:

mobile string  
mobile.keyword string  
mobile string  
mobile.keyword string

So, the 1st two from LOGA and the 2nd from LOGB.

---

<div class="post-metadata">

### Author: ![marco2005](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@marco2005](https://discuss.elastic.co/u/marco2005)
#### Post date: [June 4, 2020, 11:24am UTC](https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966/4 "2020-06-04T11:24:48Z")

</div>

So, What I want to achieve:

If I go to Datatable visualization and in the Buckets \>\> Split rows , I should be able to select Terms \>\> mobile and then similarly token and eid in the same visualization.

At the moment, when I select Terms aggregation . Under the field, I see 4 fields like I mentioned above. If I select the first and then select eid and token, nothing comes up.

---

<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 2, 2020, 11:35am UTC](https://discuss.elastic.co/t/how-to-correlate-two-log-files-based-on-a-unique-key-value-pair/234966/5 "2020-07-02T11:35:36Z")

</div>

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