Skip to content

Conversation

kares
Copy link
Contributor

@kares kares commented Dec 7, 2021

before #37 there were 2 error handlers:

 rescue LogStash::Json::ParserError => e @logger.info("JSON parse failure. Falling back to plain-text", :error => e, :data => json) yield LogStash::Event.new("message" => json, "tags" => ["_jsonparsefailure"]) rescue StandardError => e # This should NEVER happen. But hubris has been the cause of many pipeline breaking things # If something bad should happen we just don't want to crash logstash here. @logger.warn( "An unexpected error occurred parsing JSON data", :data => json, :message => e.message, :class => e.class.name, :backtrace => e.backtrace )

... this got replaced (in #37) by a single handler that logs at error level and always generates a fallback event:

 rescue => e @logger.error("JSON parse error, original data now in message field", message: e.message, exception: e.class, data: json) yield parse_json_error_event(json)

the gist of the change here is to "reduce" the logging on parsing errors to a warn and only log at the error level when smt unexpected happens ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants