# Empty array getting dropped from output, how do I keep it?

**URL:** <https://discuss.elastic.co/t/empty-array-getting-dropped-from-output-how-do-i-keep-it/313392>\
**Category:** Logstash\
**Created:** [August 31, 2022, 8:45pm UTC](https://discuss.elastic.co/t/empty-array-getting-dropped-from-output-how-do-i-keep-it/313392 "2022-08-31T20:45:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben-G](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben-g/32/104312_2.png) [@Ben-G](https://discuss.elastic.co/u/Ben-G)\
**Post date:** [August 31, 2022, 8:45pm UTC](https://discuss.elastic.co/t/empty-array-getting-dropped-from-output-how-do-i-keep-it/313392/1 "2022-08-31T20:45:11Z")

</div>

The input to my logstash is is populating `[Current][Alarms]` from the input `...\"Alarms\":null...` when there are no alarms, and when there are alarms then it is a list.  
When there are no alarms, I still want to see `"Alarms": []` in the output.

When I try to force the empty array from a Ruby block like this `event.set('[Current][Alarms]', [])` then it does not appear as a field in the output.  
Is there a way to force the empty array or will those always get dropped?

---

<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:** [August 31, 2022, 9:37pm UTC](https://discuss.elastic.co/t/empty-array-getting-dropped-from-output-how-do-i-keep-it/313392/2 "2022-08-31T21:37:17Z")

</div>

```
ruby { code => 'event.set("[Current][Alarms]", [])' }

```

results in

```
   "Current" => {
    "Alarms" => []
}

```

for me.

---

<div class="post-metadata">

**Author:** ![Ben-G](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben-g/32/104312_2.png) [@Ben-G](https://discuss.elastic.co/u/Ben-G)\
**Post date:** [August 31, 2022, 10:02pm UTC](https://discuss.elastic.co/t/empty-array-getting-dropped-from-output-how-do-i-keep-it/313392/3 "2022-08-31T22:02:12Z")

</div>

This thread can be closed. The issue was that I am using an old version of (based god) Magnus Baeck's logstash-filter-verifier. All good.

---

<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:** [September 28, 2022, 10:02pm UTC](https://discuss.elastic.co/t/empty-array-getting-dropped-from-output-how-do-i-keep-it/313392/4 "2022-09-28T22:02:49Z")

</div>

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