How to validate incoming JSON body using Http-Input plugin

Dears Elastic,

Using Http-Input plugin, I would like to know if there is a way to validate incoming Message (JSON) against a pre-defined JSON schema and return a specific response for example (Invalid Message) before passing the Input step ?

The scenario is very simple, clients are writing to ES through Logstash http input plugin and we need to make sure that they follow the index mapping that is pre-defined in ES

I'm really looking for some guidance on how to achieve this behavior.

Thank you

So you do not want to validate that it is valid JSON, you want to validate that certain fields have certain types? There is no pre-defined filter to do that. Certainly it could be implemented in logstash, but I think it would be easier to just send the event to elasticsearch and see if you get a mapping exception.

True, it is easier to rely on ES index mapping. However, how can I instantly notify the sending (client) of the mapping exception without the client listening on Logstash DLQ. If somehow I can get the input to handle the validation and respond directly to the client before sending the event to the filter.

I'm trying to see If i can leverage logstash-http input plug internally as an API with schema validation feature

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