lib/logstash/outputs/riak.rb in logstash-output-riak-0.1.4 vs lib/logstash/outputs/riak.rb in logstash-output-riak-2.0.1
- old
+ new
@@ -1,22 +1,23 @@
# encoding: utf-8
require "logstash/outputs/base"
require "logstash/namespace"
-
# Riak is a distributed k/v store from Basho.
# It's based on the Dynamo model.
-
class LogStash::Outputs::Riak < LogStash::Outputs::Base
config_name "riak"
# The nodes of your Riak cluster
# This can be a single host or
# a Logstash hash of node/port pairs
# e.g
# [source,ruby]
- # ["node1", "8098", "node2", "8098"]
+ # {
+ # "node1" => "8098"
+ # "node2" => "8098"
+ # }
config :nodes, :validate => :hash, :default => {"localhost" => "8098"}
# The protocol to use
# HTTP or ProtoBuf
# Applies to ALL backends listed above
@@ -32,23 +33,25 @@
config :bucket, :validate => :array, :default => ["logstash-%{+YYYY.MM.dd}"]
# The event key name
# variables are valid here.
#
- # Choose this carefully. Best to let riak decide....
+ # Choose this carefully. Best to let riak decide.
config :key_name, :validate => :string
# Bucket properties (NYI)
# Logstash hash of properties for the bucket
# i.e.
# [source,ruby]
- # `bucket_props => ["r", "one", "w", "one", "dw", "one"]`
+ # bucket_props => {
+ # "r" => "one"
+ # "w" => "one"
+ # "dw", "one
+ # }
# or
# [source,ruby]
- # `bucket_props => ["n_val", "3"]`
- # Note that the Logstash config language cannot support
- # hash or array values
+ # bucket_props => { "n_val" => "3" }
# Properties will be passed as-is
config :bucket_props, :validate => :hash
# Indices
# Array of fields to add 2i on
@@ -71,11 +74,15 @@
# Only applied if SSL is enabled
# Logstash hash that maps to the riak-client options
# here: https://github.com/basho/riak-ruby-client/wiki/Connecting-to-Riak
# You'll likely want something like this:
#
- # `ssl_opts => ["pem", "/etc/riak.pem", "ca_path", "/usr/share/certificates"]
+ # [source, ruby]
+ # ssl_opts => {
+ # "pem" => "/etc/riak.pem"
+ # "ca_path" => "/usr/share/certificates"
+ # }
#
# Per the riak client docs, the above sample options
# will turn on SSL `VERIFY_PEER`
config :ssl_opts, :validate => :hash
@@ -111,10 +118,10 @@
@client = Riak::Client.new(riak_opts)
end # def register
public
def receive(event)
- return unless output?(event)
+
@bucket.each do |b|
# setup our bucket(s)
bukkit = @client.bucket(event.sprintf(b))
# Disable bucket props for now