Skip to content

Instantly share code, notes, and snippets.

@takatoshiono
Created October 30, 2017 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takatoshiono/153118432cb3b9f200f3b31de73fd4c9 to your computer and use it in GitHub Desktop.
Save takatoshiono/153118432cb3b9f200f3b31de73fd4c9 to your computer and use it in GitHub Desktop.
require 'fluent/plugin/parser'
require 'heroku-log-parser'
module Fluent
module Plugin
class HerokuParser < Parser
Fluent::Plugin.register_parser('heroku', self)
def configure(conf)
super
end
def parse(data)
records = HerokuLogParser.parse(data)
yield Time.now.to_i, records
end
end
end
end
@takatoshiono
Copy link
Author

これをlib/fluent/plugin/においてfluent.confをこんな感じで書けばherokuのLog Drainsから流れてくるログを受け取れる

<source>
  @type http
  port 9880
  bind 0.0.0.0
  format heroku
</source>

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