Class: LogStash::Outputs::HipChat
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::HipChat
- Defined in:
- lib/logstash/outputs/hipchat.rb
Overview
This output allows you to write events to www.hipchat.com/[HipChat].
Make sure your API token have the appropriate permissions and support sending messages.
Instance Method Summary collapse
Instance Method Details
#client ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/logstash/outputs/hipchat.rb', line 43 def client @client ||= if @host.nil? || @host.empty? HipChat::Client.new(@token, :api_version => "v2") else HipChat::Client.new(@token, :api_version => "v2", :server_url => server_url) end end |
#receive(event) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/logstash/outputs/hipchat.rb', line 55 def receive(event) = event.sprintf(@format) from = event.sprintf(@from) color = event.sprintf(@color) room = event.sprintf(@room_id) @logger.debug("HipChat data", :from => from , :message => , :notify => trigger_notify, :color => color, :message_format => @message_format) if @logger.debug? begin client[room].send(from, , :notify => trigger_notify, :color => color, :message_format => @message_format) rescue Exception => e logger.warn("Unhandled exception", :exception => e, :stacktrace => e.backtrace) end end |
#register ⇒ Object
39 40 41 |
# File 'lib/logstash/outputs/hipchat.rb', line 39 def register require "hipchat" end |
#server_url ⇒ Object
51 52 53 |
# File 'lib/logstash/outputs/hipchat.rb', line 51 def server_url "https://#{@host}" end |