class LogStash::Filters::Schemavalid

Validate your JSON data using given JSON schema file.

This filter returns “Invalid JSON data” or “Valid JSON data” as a value of field “validation”.

Public Instance Methods

filter(event) click to toggle source
# File lib/logstash/filters/schemavalid.rb, line 34
def filter(event)

    if JSON::Validator.validate(@file_path, event["message"])
      validation = "Valid JSON data" 
    else
      validation = "Invalid JSON data"
    end
    event["validation"] = validation
    filter_matched(event)

end
register() click to toggle source
# File lib/logstash/filters/schemavalid.rb, line 30
def register
end