Class: LogStash::Outputs::PubnubCustom

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash/outputs/pubnub_custom.rb

Overview

An logstash-output-pubnub output that does nothing.

Instance Method Summary collapse

Instance Method Details

#receive(event) ⇒ Object



22
23
24
25
26
27
28
29
# 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

#registerObject



17
18
19
# 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