# Logstash - How can i get the data from a key-value pair?

**URL:** <https://discuss.elastic.co/t/logstash-how-can-i-get-the-data-from-a-key-value-pair/263134>\
**Category:** Logstash\
**Created:** [February 3, 2021, 2:33pm UTC](https://discuss.elastic.co/t/logstash-how-can-i-get-the-data-from-a-key-value-pair/263134 "2021-02-03T14:33:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinodhini](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vinodhini](https://discuss.elastic.co/u/vinodhini)\
**Post date:** [February 3, 2021, 2:33pm UTC](https://discuss.elastic.co/t/logstash-how-can-i-get-the-data-from-a-key-value-pair/263134/1 "2021-02-03T14:33:52Z")

</div>

I have a field which is like "host":{"name":"abcdef"}, How can i get the value "abcdef" alone from the host field? gsub is not allowing me to remove the {} or "name":

I tried to get the value by referencing as %{host}{name}. That does not work too.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 3, 2021, 4:45pm UTC](https://discuss.elastic.co/t/logstash-how-can-i-get-the-data-from-a-key-value-pair/263134/2 "2021-02-03T16:45:04Z")

</div>

Maybe %{[host][name]}

---

<div class="post-metadata">

**Author:** ![vinodhini](https://avatars.discourse-cdn.com/v4/letter/v/b487fb/32.png) [@vinodhini](https://discuss.elastic.co/u/vinodhini)\
**Post date:** [February 3, 2021, 6:00pm UTC](https://discuss.elastic.co/t/logstash-how-can-i-get-the-data-from-a-key-value-pair/263134/3 "2021-02-03T18:00:38Z")

</div>

Thank you very much. It worked.

---

<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 3, 2021, 6:01pm UTC](https://discuss.elastic.co/t/logstash-how-can-i-get-the-data-from-a-key-value-pair/263134/4 "2021-03-03T18:01:17Z")

</div>

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