# How to access existing field in KV filter plugin?

**URL:** <https://discuss.elastic.co/t/how-to-access-existing-field-in-kv-filter-plugin/139134>\
**Category:** Logstash\
**Created:** [July 9, 2018, 10:12am UTC](https://discuss.elastic.co/t/how-to-access-existing-field-in-kv-filter-plugin/139134 "2018-07-09T10:12:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelvink](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@kelvink](https://discuss.elastic.co/u/kelvink)\
**Post date:** [July 9, 2018, 10:12am UTC](https://discuss.elastic.co/t/how-to-access-existing-field-in-kv-filter-plugin/139134/1 "2018-07-09T10:12:31Z")

</div>

How can we access a field that was created in a previous grok match step (eg. [app\_name]) and dynamically use that value to control the value of "target" in the kv filter plugin?

eg:  
grok {  
match =\> { "[inputdata]" =\> "(?\<app\_name\>[\w]+)"}  
}

kv {  
source =\> "[kv\_params]"  
**target =\> "url\_params"**  
#target =\> "%{[app\_name]}\_params" ## NOT WORKING  
field\_split =\> "&"  
remove\_field =\> "[kv\_params]"  
}

...

My first attempt was to try a similar approach used to access the metadata field %{[@metadata][beat]} in the output , but seems that it's not working within the filter / KV portion.

---

<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:** [July 9, 2018, 11:56am UTC](https://discuss.elastic.co/t/how-to-access-existing-field-in-kv-filter-plugin/139134/2 "2018-07-09T11:56:59Z")

</div>

> <https://github.com/logstash-plugins/logstash-filter-kv/issues/35>

---

<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 6, 2018, 12:05pm UTC](https://discuss.elastic.co/t/how-to-access-existing-field-in-kv-filter-plugin/139134/3 "2018-08-06T12:05:27Z")

</div>

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