Skip to content

Instantly share code, notes, and snippets.

@dmreiland
Forked from kiyoto/fluentd-recover.rb
Last active August 31, 2015 02:01
Show Gist options
  • Save dmreiland/c786fe02d21ec9d98dee to your computer and use it in GitHub Desktop.
Save dmreiland/c786fe02d21ec9d98dee to your computer and use it in GitHub Desktop.
require 'fluent-logger'
# specify the host and port to forward data to
logger = Fluent::Logger.new(nil, :host => "localhost", :port => 24224)
fn = ARGV[0]
fh = File.new(fn)
msgpack_unpacker = MessagePack::Unpacker.new(fh)
begin
msgpack_unpacker.each do |time, record|
# post data with the tag "t"
logger.post_with_time('t', record, time)
end
ensure
fh.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment