logstash-plugins / logstash-input-java_input_example

EXPERIMENTAL: Example Java input plugin for Logstash to bootstrap your effort to write your own Java input plugin!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Recommended way to return a config validation error

cpmoore opened this issue · comments

I know you're supposed to validate the configuration in the plugin constructor, but I was wondering if there was a recommended way to return an error.
Currently I'm just logging the error and setting a flag to not start the plugin. Is there a specific exception I should be throwing?

Typically, an IllegalStateException is thrown so Logstash is prevented from starting with an input in an invalid state. You can see an example of that in the stdin Java input that is included in Logstash:

https://github.com/elastic/logstash/blob/2360d0f72adb2962e56485cd22222074155c564a/logstash-core/src/main/java/org/logstash/plugins/inputs/Stdin.java#L65