# Kv plugin behavior

**URL:** https://discuss.elastic.co/t/kv-plugin-behavior/149304
**Category:** Logstash
**Created:** [September 20, 2018, 1:44pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304 "2018-09-20T13:44:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alan.frabutt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alan.frabutt/32/35719_2.png) [@alan.frabutt](https://discuss.elastic.co/u/alan.frabutt)
#### Post date: [September 20, 2018, 1:44pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304/1 "2018-09-20T13:44:58Z")

</div>

Greetings all,  
I believe I've made a solid effort digging around other posts (and sites) for more info, but I'm not getting traction. The behavior I'd expect from the code below is that it would break out each kv pair in the messages field into discrete searchable things. Not seeing that tho.

```
filter {
   if [type] == "syslog" {
     mutate {
       gsub => ["message", "\"", ""]
       gsub => ["message", ": ", "="]
     }
     kv {
        source => "message" 
        include_keys => ["sysloghost", "severity", "facility", "programname", "procid"]
     }
   }
 }

```

Any obvious problems with that?

Many thanks in advance!

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [September 20, 2018, 5:35pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304/2 "2018-09-20T17:35:46Z")

</div>

What does the input look like? What output do you get?

---

<div class="post-metadata">

### Author: ![alan.frabutt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alan.frabutt/32/35719_2.png) [@alan.frabutt](https://discuss.elastic.co/u/alan.frabutt)
#### Post date: [September 20, 2018, 7:18pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304/3 "2018-09-20T19:18:16Z")

</div>

Thanks for the prompt response! 1st I'd like to verify I'm not operating under false assumptions. If I were to configure logstash with the syslog input plugin, and direct a vanilla Linux rsyslogd log stream to it, then output to elasticsearch, should I expect kibana to show the individual kv pairs inside the message field to exist as searchable fields? I'm sanitizing example data now for upload.

---

<div class="post-metadata">

### Author: ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)
#### Post date: [September 20, 2018, 7:59pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304/4 "2018-09-20T19:59:07Z")

</div>

The KV filter plugin allows you to specify your `field_split` and `value_split` character classes (or even full splitter patterns with `field_split_pattern` and `value_split_pattern` in later releases); it is also pretty good at capturing quoted values. You might not need to do gsub operations to clean up the data before invoking the kv filter.

Docs for current version are [here](https://www.elastic.co/guide/en/logstash/current/plugins-filters-kv.html).

---

<div class="post-metadata">

### Author: ![alan.frabutt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alan.frabutt/32/35719_2.png) [@alan.frabutt](https://discuss.elastic.co/u/alan.frabutt)
#### Post date: [September 24, 2018, 3:53pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304/5 "2018-09-24T15:53:56Z")

</div>

Let's just close this one out... the problem doesn't appear to have anything to do with kv. I've tried following the example at  
[https://www.elastic.co/blog/how-to-centralize-logs-with-rsyslog-logstash-and-elasticsearch-on-ubuntu-14-04](https://www.elastic.co/blog/how-to-centralize-logs-with-rsyslog-logstash-and-elasticsearch-on-ubuntu-14-04), and I'm getting \_jasonparsefailure, so I'll try to follow that breadcrumb trail.

---

<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 22, 2018, 3:53pm UTC](https://discuss.elastic.co/t/kv-plugin-behavior/149304/6 "2018-10-22T15:53:58Z")

</div>

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