class LogStash::Outputs::PubnubCustom

An logstash-output-pubnub output that does nothing.

Public Instance Methods

receive(event) click to toggle source
# File lib/logstash/outputs/pubnub_custom.rb, line 22
def receive(event)
  document = {}.merge(event.to_hash)
  keys = @channel_keys.to_s.split(",")
  message = JSON.parse(document['message'])
  channel = message[keys[0]]+ ":"+ message[keys[1]]+ ":"+  message[keys[2]]
  puts channel
  @pubnub.publish(http_sync: true, message: document , channel: channel.to_s)
end
register() click to toggle source

config :max_entries, :validate => :integer, :default => -1 config :ip_key, :string, :default => 'ip'

# File lib/logstash/outputs/pubnub_custom.rb, line 17
def register
  @pubnub = Pubnub.new( publish_key: @pubnub_publish_key, subscribe_key: @pubnub_subscribe_key, logger: Logger.new(STDOUT) )
end