# Can I pass an array into a plugin through a field

**URL:** <https://discuss.elastic.co/t/can-i-pass-an-array-into-a-plugin-through-a-field/280672>\
**Category:** Logstash\
**Created:** [August 6, 2021, 4:50pm UTC](https://discuss.elastic.co/t/can-i-pass-an-array-into-a-plugin-through-a-field/280672 "2021-08-06T16:50:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![R.L](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@R.L](https://discuss.elastic.co/u/R.L)\
**Post date:** [August 6, 2021, 4:50pm UTC](https://discuss.elastic.co/t/can-i-pass-an-array-into-a-plugin-through-a-field/280672/1 "2021-08-06T16:50:48Z")

</div>

I am currently writing a custom java plugin for Logstash.

One of the input settings is an array.

This array might be set in another field within the logstash event.

so basically I want to be able to do this:

```auto
#array_field=> ["aa","bb"]

my_plugin{

roles=> {array_field}

}

```

On the back end in my java code I handle the input config using this

```auto
private static final PluginConfigSpec<List<Object>> ROLES_CONFIG = PluginConfigSpec.arraySetting(roles);

```

So I want array\_field to be passed as an array (not a string) into the roles plugin setting parameter. But I don't now how.

It seems like "array\_field" just gets passed in as a string literal when I try and my plugin throws error about how it's expecting an array not a string. Is there a way in Logstash to pass array\_field's content as an array into my plugin?

---

<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 3, 2021, 4:50pm UTC](https://discuss.elastic.co/t/can-i-pass-an-array-into-a-plugin-through-a-field/280672/2 "2021-09-03T16:50:52Z")

</div>

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