# Kv filter

**URL:** <https://discuss.elastic.co/t/kv-filter/102455>\
**Category:** Logstash\
**Created:** [October 2, 2017, 4:47pm UTC](https://discuss.elastic.co/t/kv-filter/102455 "2017-10-02T16:47:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pola](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@Pola](https://discuss.elastic.co/u/Pola)\
**Post date:** [October 2, 2017, 4:47pm UTC](https://discuss.elastic.co/t/kv-filter/102455/1 "2017-10-02T16:47:48Z")

</div>

Hi,

I am trying to filter key values from 'message' field

"message": "\<188\>Oct 2 16:17:39.000 68.85.2.39 alarm[1318]: Alarm set: License color=YELLOW, class=SECOND, reason=Protocol usage requires a license\n"

I wanted to filter to:

color=YELLOW  
class=SECOND  
reason=Protocol usage requires a license

Below is KV that i used and i could able to filter class and reason but not color. Any suggestions are greatly welcome.  
kv {  
source =\> "message"  
field\_split =\> ","  
value\_split =\> "="  
trim\_key =\> " \t"  
include\_keys =\> ["color", "class", "reason"]  
trim\_value =\> ",\t"

```
}
```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 2, 2017, 4:53pm UTC](https://discuss.elastic.co/t/kv-filter/102455/2 "2017-10-02T16:53:54Z")

</div>

Use a grok filter to capture the various parts of the message into separate fields. Once you have the part that contains the kv list in a field, apply the kv filter just to that.

---

<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 30, 2017, 4:54pm UTC](https://discuss.elastic.co/t/kv-filter/102455/3 "2017-10-30T16:54:05Z")

</div>

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