class LogStash::Outputs::HipChat

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.

Public Instance Methods

client() click to toggle source
# 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) click to toggle source
# File lib/logstash/outputs/hipchat.rb, line 55
def receive(event)
  

  message = event.sprintf(@format)
  from = event.sprintf(@from)
  color = event.sprintf(@color)
  room = event.sprintf(@room_id)

  @logger.debug("HipChat data", :from => from , :message => message, :notify => trigger_notify, :color => color, :message_format => @message_format) if @logger.debug?

  begin
    client[room].send(from, message, :notify => trigger_notify, :color => color, :message_format => @message_format)
  rescue Exception => e
    logger.warn("Unhandled exception", :exception => e, :stacktrace => e.backtrace)
  end
end
register() click to toggle source
# File lib/logstash/outputs/hipchat.rb, line 39
def register
  require "hipchat"
end
server_url() click to toggle source
# File lib/logstash/outputs/hipchat.rb, line 51
def server_url
  "https://#{@host}"
end