# Logstash filter mutate remove\_field inside of an array

**URL:** <https://discuss.elastic.co/t/logstash-filter-mutate-remove-field-inside-of-an-array/168503>\
**Category:** Logstash\
**Created:** [February 15, 2019, 1:23am UTC](https://discuss.elastic.co/t/logstash-filter-mutate-remove-field-inside-of-an-array/168503 "2019-02-15T01:23:39Z")\
**Posts on this page:** 1\
**Showing post:** 11

<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 16, 2019, 12:41am UTC](https://discuss.elastic.co/t/logstash-filter-mutate-remove-field-inside-of-an-array/168503/11 "2019-02-16T00:41:22Z")

</div>

If the volumes array has multiple entries (which it probably does sometimes, otherwise there would be little reason to make it an array), then you could either add enough remove\_field entries to cover all of them, or you could use a ruby filter to iterate over the array

```
    ruby {
        code => '
            volumesArray = event.get("volumes")
            if volumesArray
                newVolumesArray = []
                volumesArray.each { |x|
                    x.delete("lun-mapping-list")
                    newVolumesArray << x
                }
                event.set("volumes", newVolumesArray)
            end
        '
    }
```

---

_[View the full topic](https://discuss.elastic.co/t/logstash-filter-mutate-remove-field-inside-of-an-array/168503)._
