# Kafka output topic\_id

**URL:** <https://discuss.elastic.co/t/kafka-output-topic-id/166756>\
**Category:** Logstash\
**Created:** [February 1, 2019, 3:35pm UTC](https://discuss.elastic.co/t/kafka-output-topic-id/166756 "2019-02-01T15:35:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reb](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@Reb](https://discuss.elastic.co/u/Reb)\
**Post date:** [February 1, 2019, 3:35pm UTC](https://discuss.elastic.co/t/kafka-output-topic-id/166756/1 "2019-02-01T15:35:28Z")

</div>

I try to use this plugin  
output {  
kafka{

```
                            bootstrap_servers => "dal-b-23971:29090,dal-b-23971:29091,dal-b-23971:29092"
                            topic_id => " **_%{[fields][app_id]}_**"
                            codec => plain {
                                    format => "%{message}"
                            }
                    }

```

}

i would like to take the string into this variable : %{[fields][app\_id]}

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [February 4, 2019, 12:57pm UTC](https://discuss.elastic.co/t/kafka-output-topic-id/166756/2 "2019-02-04T12:57:04Z")

</div>

I'm not sure what you mean.

Do you have a value in the field `[fields][app_id]` or are you looking to put a value into that field before the event get to the output stage?

When using interpolation, if the field does not exist the the text `"[fields][app_id]"` is returned by the `%{}` interpolation operation so your topic\_id ends up being `**_[fields][app_id]_**` with a space at either end.

---

<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:** [March 4, 2019, 12:57pm UTC](https://discuss.elastic.co/t/kafka-output-topic-id/166756/3 "2019-03-04T12:57:10Z")

</div>

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