Skip to content

Instantly share code, notes, and snippets.

@mark-adams
Created November 30, 2015 05:12
Show Gist options
  • Save mark-adams/c4826e28f87d52c06b66 to your computer and use it in GitHub Desktop.
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.
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