Created
September 30, 2013 19:02
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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