Skip to content

Instantly share code, notes, and snippets.

@mfn
Created September 30, 2013 19:02
Show Gist options
  • Save mfn/6768467 to your computer and use it in GitHub Desktop.
Save mfn/6768467 to your computer and use it in GitHub Desktop.
Primitive patch against logstash 1.2.1 to fight utf-8 encoding problems from logfiles you can't control
diff --git a/lib/logstash/outputs/redis.rb b/lib/logstash/outputs/redis.rb
index 7aab4f2..cb5c4aa 100644
--- a/lib/logstash/outputs/redis.rb
+++ b/lib/logstash/outputs/redis.rb
@@ -148,10 +148,11 @@ class LogStash::Outputs::Redis < LogStash::Outputs::Base
# if they fail to convert properly.
begin
payload = event.to_json
- rescue Encoding::UndefinedConversionError, ArgumentError
+ rescue Exception => e
puts "FAILUREENCODING"
@logger.error("Failed to convert event to JSON. Invalid UTF-8, maybe?",
- :event => event.inspect)
+ :event => event.inspect,
+ :message => e.message)
return
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment