# Remove fields object event

**URL:** https://discuss.elastic.co/t/remove-fields-object-event/141826
**Category:** Logstash
**Created:** [July 26, 2018, 5:42pm UTC](https://discuss.elastic.co/t/remove-fields-object-event/141826 "2018-07-26T17:42:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![robsonkades](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robsonkades/32/33776_2.png) [@robsonkades](https://discuss.elastic.co/u/robsonkades)
#### Post date: [July 26, 2018, 5:42pm UTC](https://discuss.elastic.co/t/remove-fields-object-event/141826/1 "2018-07-26T17:42:11Z")

</div>

Hello

how do I remove all event objects dynamically

[https://www.rubydoc.info/gems/logstash-core-event/2.3.4/LogStash/Event](https://www.rubydoc.info/gems/logstash-core-event/2.3.4/LogStash/Event)

I need this because my message comes through the metada, fields that are in it is also in the event object.

basically I need to iterate over them and removing all.

I'm a beginner at logstash, sorry for the Google translator  
help: D

---

<div class="post-metadata">

### Author: ![robsonkades](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robsonkades/32/33776_2.png) [@robsonkades](https://discuss.elastic.co/u/robsonkades)
#### Post date: [July 26, 2018, 5:43pm UTC](https://discuss.elastic.co/t/remove-fields-object-event/141826/2 "2018-07-26T17:43:09Z")

</div>

I already tried something like

code =\> "event.to\_hash.each {| k, v |  
event.remove (k)} "

but without success

---

<div class="post-metadata">

### Author: ![robsonkades](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robsonkades/32/33776_2.png) [@robsonkades](https://discuss.elastic.co/u/robsonkades)
#### Post date: [July 26, 2018, 5:49pm UTC](https://discuss.elastic.co/t/remove-fields-object-event/141826/3 "2018-07-26T17:49:39Z")

</div>

Resolved 😃

---

<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: [August 23, 2018, 5:49pm UTC](https://discuss.elastic.co/t/remove-fields-object-event/141826/4 "2018-08-23T17:49:40Z")

</div>

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