# Filter elements based on array constant or array environment variable

**URL:** https://discuss.elastic.co/t/filter-elements-based-on-array-constant-or-array-environment-variable/269074
**Category:** Logstash
**Created:** [April 1, 2021, 6:52pm UTC](https://discuss.elastic.co/t/filter-elements-based-on-array-constant-or-array-environment-variable/269074 "2021-04-01T18:52:57Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [April 1, 2021, 7:41pm UTC](https://discuss.elastic.co/t/filter-elements-based-on-array-constant-or-array-environment-variable/269074/2 "2021-04-01T19:41:53Z")

</div>

> [@Automation\_Scripts](#):
>
> How can we declare an array as constant to use it within the filtering?

In general you cannot. logstash will treat the substituted environment variable as a string, not an array. There is a very specific [case](https://github.com/elastic/logstash/pull/12051) (plugin options that use `:list => true` and `:validate => :uri`) where it will get converted to an array but that is the only case that I know of.

---

_[View the full topic](https://discuss.elastic.co/t/filter-elements-based-on-array-constant-or-array-environment-variable/269074)._
