# Json target based field value (or tag)?

**URL:** <https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350>\
**Category:** Logstash\
**Created:** [May 5, 2016, 9:54pm UTC](https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350 "2016-05-05T21:54:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robinpblanchard](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@robinpblanchard](https://discuss.elastic.co/u/robinpblanchard)\
**Post date:** [May 5, 2016, 9:54pm UTC](https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350/1 "2016-05-05T21:54:34Z")

</div>

Hi,

I'd like to dynamically set the json target based on a field value. I tried:

target =\> "%{field}"

with no success. Is there an easy way to accomplish this?

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [May 6, 2016, 2:35pm UTC](https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350/2 "2016-05-06T14:35:40Z")

</div>

I assume you are talking about the json filter? If so the current implementation of the plugin doesn't support using field reference, the "%{field}" syntax, as the target to the decoded string.

I suggest you create an issue on the plugin repository on github

> **[logstash-plugins/logstash-filter-json](https://github.com/logstash-plugins/logstash-filter-json)**
>
> Contribute to logstash-filter-json development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![robinpblanchard](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@robinpblanchard](https://discuss.elastic.co/u/robinpblanchard)\
**Post date:** [May 6, 2016, 2:42pm UTC](https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350/3 "2016-05-06T14:42:06Z")

</div>

created:

> <https://github.com/logstash-plugins/logstash-filter-json/issues/28>

thanks!

---

<div class="post-metadata">

**Author:** ![pmanthena](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pmanthena/32/10270_2.png) [@pmanthena](https://discuss.elastic.co/u/pmanthena)\
**Post date:** [June 12, 2016, 2:05pm UTC](https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350/4 "2016-06-12T14:05:16Z")

</div>

I tried the below in the filter , I don't know weather it is right or wrong but itz perfectly worked for me.

```
filter {
	json{
	source => "json_message"
	target => "dynamic_json_field"
  }
  mutate {
    rename => { "dynamic_json_field" => "%{type}" }
  }
}
```

---

<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 6, 2017, 4:53am UTC](https://discuss.elastic.co/t/json-target-based-field-value-or-tag/49350/5 "2017-07-06T04:53:28Z")

</div>


