# Fetch unique values of field in Similar logs

**URL:** https://discuss.elastic.co/t/fetch-unique-values-of-field-in-similar-logs/140625
**Category:** Kibana
**Created:** [July 18, 2018, 9:33pm UTC](https://discuss.elastic.co/t/fetch-unique-values-of-field-in-similar-logs/140625 "2018-07-18T21:33:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![deadPix3l](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deadpix3l/32/28707_2.png) [@deadPix3l](https://discuss.elastic.co/u/deadPix3l)
#### Post date: [July 18, 2018, 9:33pm UTC](https://discuss.elastic.co/t/fetch-unique-values-of-field-in-similar-logs/140625/1 "2018-07-18T21:33:09Z")

</div>

I have an index with about a quarter million logs and growing.  
many logs are exactly the same except one field. ie. (only an example)  
{  
event\_id: 1265,  
reason: "permission denied",  
file: "/etc/shadow"  
process: "chrome.exe",  
host: "box\_A"  
}

sometimes an identical event occurs on multiple hosts. How can i get from "What events happened on host A?" to "for each of those, what other hosts did they occur on?"

How do i view all identical events which occured on more than X different hosts, and find out which hosts those were?

---

<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: [July 18, 2018, 10:44pm UTC](https://discuss.elastic.co/t/fetch-unique-values-of-field-in-similar-logs/140625/2 "2018-07-18T22:44:05Z")

</div>

Hi,

This is a simple terms agg in a datatable in my local:

 ![34%20PM](https://us1.discourse-cdn.com/elastic/original/3X/7/1/713823290fe99132ed389468236b78f81e392385.jpg)

I am looking at the count of documents which contain that city name.

So instead of count here - you can use other agg.

Does it help?

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![deadPix3l](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deadpix3l/32/28707_2.png) [@deadPix3l](https://discuss.elastic.co/u/deadPix3l)
#### Post date: [July 19, 2018, 1:24am UTC](https://discuss.elastic.co/t/fetch-unique-values-of-field-in-similar-logs/140625/3 "2018-07-19T01:24:37Z")

</div>

I'm currently using unique count, but it's not perfect.

So for each event\_id or for each process, which are not unique to the log, I can see a count of how many unique hosts have had such an event. So for 1265, let's say I get 4. 4 hosts have experienced as 1265 ("permission denied") error. Now do I get from that to which 4 are they, for all (or top 100?) error codes.

---

<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: [August 16, 2018, 1:24am UTC](https://discuss.elastic.co/t/fetch-unique-values-of-field-in-similar-logs/140625/4 "2018-08-16T01:24:49Z")

</div>

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