Created
November 30, 2015 05:12
-
-
Save mark-adams/c4826e28f87d52c06b66 to your computer and use it in GitHub Desktop.
A handy fluentd filter for lifting out nested json log messages from Docker logs.
This file contains 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
module Fluent | |
class LiftJsonFilter < Filter | |
Fluent::Plugin.register_filter('lift_json', self) | |
def filter(tag, time, record) | |
begin | |
record = record.merge JSON.parse(record['log']) | |
record.delete 'log' | |
rescue Exception | |
end | |
record | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment