class Fluent::ClickHouseOutput
Attributes
handler[RW]
path[RW]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_clickhouse.rb, line 22 def initialize super require 'clickhouse' end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_clickhouse.rb, line 32 def configure(conf) super if conf['columns'] @columns = conf['columns'].split(',').map { |m| m.strip } end @config = {} if conf['username'] @config['username'] = conf['username'] end if conf['password'] @config['password'] = conf['password'] end if conf['urls'] @urls = @urls.split(',').map { |m| m.strip } elsif conf['host'] @config['host'] = conf['host'] end if conf['port'] @config['port'] = conf['port'] end @config['database'] = conf['database'] end
format(tag, time, record)
click to toggle source
# File lib/fluent/plugin/out_clickhouse.rb, line 65 def format(tag, time, record) [tag, time, record].to_msgpack end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_clickhouse.rb, line 61 def shutdown super end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/out_clickhouse.rb, line 57 def start super end
write(chunk)
click to toggle source
# File lib/fluent/plugin/out_clickhouse.rb, line 69 def write(chunk) Clickhouse.establish_connection(@config) Clickhouse.connection.insert_rows(@table, :names => @columns) { |rows| chunk.msgpack_each { |tag, time, record| rows << @columns.map { |m| record[m] } } rows } end