Logstash support redis cluster

1、update redis-rb version to 4.1.3
2、update /vendor/bundle/jruby/2.3.0/gemslogstash-output-redis-4.0.4/lib /logstash/outputs/redis.rb

#if not @current_port
#  @current_port = @port
#end

#params = {
#  :host => @current_host,
#  :port => @current_port,
#  :timeout => @timeout,
#  :db => @db
#}
#@logger.debug("connection params", params)

if @cluster
  Redis.new(cluster:@host)
else 
  @current_host, @current_port = @host[@host_idx].split(':')
  @host_idx = @host_idx + 1 >= @host.length ? 0 : @host_idx + 1
  if not @current_port
    @current_port = @port
  end

  params = {
    :host => @current_host,
    :port => @current_port,
    :timeout => @timeout,
    :db => @db
  }

  if @password
    params[:password] = @password.value
  end
  @logger.debug("connection params", params)
  Redis.new(params)
end

3、output info:
output {
if [logtype]=="redis" {
redis {
codec => plain {
format => "%{startDate} %{startHour} %{responseTime} %{apiCode} %{apiType} %{uid} %{success}"
}
data_type => "list"
key => "jdbc_sample_test"
host => ["redis://@172.24.5.244:7000","redis://@172.24.5.244:7001","redis://@172.24.5.244:7002","redis://@172.24.5.245:7000","redis://@172.24.5.245:7001","redis://@172.24.5.245:7002"]
batch => true
cluster => true
}
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.