# \[Solved\] Custom Logstash filter validation question

**URL:** <https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338>\
**Category:** Logstash\
**Created:** [May 30, 2016, 4:11pm UTC](https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338 "2016-05-30T16:11:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulkeogh](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@paulkeogh](https://discuss.elastic.co/u/paulkeogh)\
**Post date:** [May 30, 2016, 4:11pm UTC](https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338/1 "2016-05-30T16:11:32Z")

</div>

Hi,

I have a working Logstash filter on which I want to enhance the validation;

I have a config item of;

config :da\_order, :validate =\> :array, :default =\> ["Destination IMSI", "Destination MSC Address", "Destination Address"]

Is there any way that I can either write a custom validator for this config variable or use an existing one to ensure that the array has 3 values and that each value matches a specific string ?

Thanks,

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 30, 2016, 8:47pm UTC](https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338/2 "2016-05-30T20:47:40Z")

</div>

This is a custom plugin that you've written, right? There might be a way to supply a validation function, but otherwise you can make the check in the register method and raise a LogStash::ConfigurationError exception if `@da_order` doesn't comply with the protocol.

---

<div class="post-metadata">

**Author:** ![paulkeogh](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@paulkeogh](https://discuss.elastic.co/u/paulkeogh)\
**Post date:** [May 31, 2016, 7:55am UTC](https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338/3 "2016-05-31T07:55:39Z")

</div>

Yes its a custom filter. A validation function is exactly what I am looking for but I cannot see any examples that illustrate that technique.

Thanks for the register method suggestion.

---

<div class="post-metadata">

**Author:** ![purbon](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@purbon](https://discuss.elastic.co/u/purbon)\
**Post date:** [May 31, 2016, 10:23am UTC](https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338/4 "2016-05-31T10:23:29Z")

</div>

As @magnusbaeck correctly said, there is actually no way to pass your custom validation function for the config options, however this is a great extension point for our config validation, see [https://github.com/elastic/logstash/issues/5395](https://github.com/elastic/logstash/issues/5395) for a followup issue in logstash.

For now the best you can do is using the register method.

- purbon

---

<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:** [July 6, 2017, 4:55am UTC](https://discuss.elastic.co/t/solved-custom-logstash-filter-validation-question/51338/5 "2017-07-06T04:55:19Z")

</div>

Closed on July 6, 2017, 4:55am UTC


