# How to remove the fields

**URL:** <https://discuss.elastic.co/t/how-to-remove-the-fields/290663>\
**Category:** Logstash\
**Created:** [December 1, 2021, 12:41pm UTC](https://discuss.elastic.co/t/how-to-remove-the-fields/290663 "2021-12-01T12:41:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahul\_sirugudi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_sirugudi/32/94019_2.png) [@rahul\_sirugudi](https://discuss.elastic.co/u/rahul_sirugudi)\
**Post date:** [December 1, 2021, 12:41pm UTC](https://discuss.elastic.co/t/how-to-remove-the-fields/290663/1 "2021-12-01T12:41:40Z")

</div>

Hi,

I am using filebeat to ship logs to logstash, and creating index. Now while visualising logs from kibana there are many unwanted fields i am seeing like agent.id, cloud.account.id. I want to remove all the fields. I want to see only message agent.hostname.

i tried using remove\_field which specified [here](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-remove_field)

```auto
filter {
      mutate {
        remove_field => ["agent.%{somefield}"]
      }
    }

```

but still i see fields in the kibana dashboard.

---

<div class="post-metadata">

**Author:** ![Cad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cad/32/86661_2.png) [@Cad](https://discuss.elastic.co/u/Cad)\
**Post date:** [December 1, 2021, 1:24pm UTC](https://discuss.elastic.co/t/how-to-remove-the-fields/290663/2 "2021-12-01T13:24:36Z")

</div>

Hi,

In the documentation you can find :

- `If the event has field "somefield" == "hello" this filter, on success, would remove the field with name "foo_hello" if it is present.`

If the field `somefield` do not exist, no field will be deleted.  
In your case, something like this would be enough.

```auto
filter {
      mutate {
        remove_field => ["agent.id", "cloud.account.id"]
      }
    }

```

Cad.

---

<div class="post-metadata">

**Author:** ![rahul\_sirugudi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_sirugudi/32/94019_2.png) [@rahul\_sirugudi](https://discuss.elastic.co/u/rahul_sirugudi)\
**Post date:** [December 1, 2021, 1:32pm UTC](https://discuss.elastic.co/t/how-to-remove-the-fields/290663/3 "2021-12-01T13:32:04Z")

</div>

> [@Cad](#):
>
> `cloud.account.id`

Thank you.  
I tried with agent.id. Still seeing this values in kibana.  
I have restarted logstatsh after modifying conf file.

---

<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:** [December 1, 2021, 7:19pm UTC](https://discuss.elastic.co/t/how-to-remove-the-fields/290663/4 "2021-12-01T19:19:28Z")

</div>

You might want try a prune filter with the blacklist\_names option.

---

<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:** [December 29, 2021, 7:19pm UTC](https://discuss.elastic.co/t/how-to-remove-the-fields/290663/5 "2021-12-29T19:19:38Z")

</div>

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