class Fluent::RedisPublishOutput
Attributes
redis[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_redis_publish.rb, line 13 def initialize super require 'redis' require 'json' require 'msgpack' end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_redis_publish.rb, line 20 def configure(conf) super end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_redis_publish.rb, line 38 def format(tag, time, record) [tag, time, record].to_msgpack end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_redis_publish.rb, line 34 def shutdown super end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_redis_publish.rb, line 24 def start super if @path @redis = Redis.new(:path => @path, :db => @db) else @redis = Redis.new(:host => @host, :port => @port, :db => @db); end end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_redis_publish.rb, line 42 def write(chunk) @redis.pipelined do chunk.msgpack_each do |(tag, time, record)| record["time"] = time if @format == "json" @redis.publish(tag, record.to_json) elsif @format == "msgpack" @redis.publish(tag, record.to_msgpack) end end end end