# Getting multiple fields out of agent

**URL:** <https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228>\
**Category:** Logstash\
**Created:** [February 24, 2022, 11:29pm UTC](https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228 "2022-02-24T23:29:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![itschobot](https://avatars.discourse-cdn.com/v4/letter/i/439d5e/32.png) [@itschobot](https://discuss.elastic.co/u/itschobot)\
**Post date:** [February 24, 2022, 11:29pm UTC](https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228/1 "2022-02-24T23:29:55Z")

</div>

still new and learning filters... how would I get multiple fields out of agent?

```auto
"agent" => {
"hostname" => "2487b31167e2",
 "name" => "123b456c",
"ephemeral_id" => "123b456c",
"version" => "7.15.1",
   "id" => "123b456c",
 "type" => "filebeat"
},

```

---

<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 24, 2022, 11:36pm UTC](https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228/2 "2022-02-24T23:36:42Z")

</div>

> [@itschobot](#):
>
> how would I get multiple fields out of agent?

What do you mean by that?

---

<div class="post-metadata">

**Author:** ![itschobot](https://avatars.discourse-cdn.com/v4/letter/i/439d5e/32.png) [@itschobot](https://discuss.elastic.co/u/itschobot)\
**Post date:** [February 24, 2022, 11:43pm UTC](https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228/3 "2022-02-24T23:43:03Z")

</div>

as an example:

if I wanted to get

```auto
 "hostname => 2487b31167e2"
"ephemeral_id" => "123b456c",
"version" => "7.15.1",

```

would I have to do:

```auto
"agent" => "[agent][version]"
"agent" => "[ephemeral][id]"
"agent" => "[hostname]"

```

the json is nested within agent portion

---

<div class="post-metadata">

**Author:** ![itschobot](https://avatars.discourse-cdn.com/v4/letter/i/439d5e/32.png) [@itschobot](https://discuss.elastic.co/u/itschobot)\
**Post date:** [March 15, 2022, 8:22pm UTC](https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228/4 "2022-03-15T20:22:25Z")

</div>

To get multiple fields out of "agent" now that I've solved the issue is using the "add field" function.  
this can be found in documentation and a good example I fell on was this video: [How to use Logstash to parse and import JSON data into Elasticsearch - YouTube](https://www.youtube.com/watch?v=_qgS1m6NTIE&t=350s)

---

<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:** [April 12, 2022, 8:22pm UTC](https://discuss.elastic.co/t/getting-multiple-fields-out-of-agent/298228/5 "2022-04-12T20:22:42Z")

</div>

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