# Remove a field before being sent to output

**URL:** <https://discuss.elastic.co/t/remove-a-field-before-being-sent-to-output/132175>\
**Category:** Logstash\
**Created:** [May 16, 2018, 4:22pm UTC](https://discuss.elastic.co/t/remove-a-field-before-being-sent-to-output/132175 "2018-05-16T16:22:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [May 16, 2018, 4:22pm UTC](https://discuss.elastic.co/t/remove-a-field-before-being-sent-to-output/132175/1 "2018-05-16T16:22:25Z")

</div>

I am trying to add a custom `_id` field as follows:

My `filter.conf`

```
filter {

  prune {
     whitelist_names => ["^http_user$"]
   }

   mutate {
     rename => { "http_user" => "username" }
     add_field => ['custom_id', '0']
   }

  fingerprint {
    key => "somekey"
    base64encode => true
    method => "SHA512"
    source => ["http_user"]
    target => "custom_id"
   }

}

```

and my `output.conf`

```
output {

    elasticsearch {
      hosts => ["elasticsearch:9200"]
      index => "my_index_name"
      document_id => "%{custom_id}"
    }

    stdout {
      codec => rubydebug
    }

}

```

However i do **not** want `custom_id` to make it to `elasticsearch`.  
Is there a way to go about it?

---

<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:** [May 16, 2018, 4:55pm UTC](https://discuss.elastic.co/t/remove-a-field-before-being-sent-to-output/132175/2 "2018-05-16T16:55:30Z")

</div>

Call it [metadata][custom\_id] instead of [custom\_id].

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 16, 2018, 7:35pm UTC](https://discuss.elastic.co/t/remove-a-field-before-being-sent-to-output/132175/3 "2018-05-16T19:35:26Z")

</div>

> Call it [metadata][custom\_id] instead of [custom\_id].

Better make it `[@metadata][custom_id]`.

---

<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:** [June 13, 2018, 7:35pm UTC](https://discuss.elastic.co/t/remove-a-field-before-being-sent-to-output/132175/4 "2018-06-13T19:35:29Z")

</div>

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