class LogStash::Outputs::Xmpp
This output allows you ship events over XMPP/Jabber.
This plugin can be used for posting events to humans over XMPP, or you can use it for PubSub or general message passing for logstash to logstash.
Public Instance Methods
connect()
click to toggle source
# File lib/logstash/outputs/xmpp.rb, line 53 def connect Jabber::debug = true client = Jabber::Client.new(Jabber::JID.new(@user)) client.connect(@host) client.auth(@password.value) return client end
receive(event)
click to toggle source
# File lib/logstash/outputs/xmpp.rb, line 62 def receive(event) return unless output?(event) string_message = event.sprintf(@message) @users.each do |user| msg = Jabber::Message.new(user, string_message) msg.type = :chat @client.send(msg) end # @targets.each msg = Jabber::Message.new(nil, string_message) msg.type = :groupchat @mucs.each do |muc| muc.send(msg) end # @mucs.each end
register()
click to toggle source
# File lib/logstash/outputs/xmpp.rb, line 34 def register require "xmpp4r" @client = connect @mucs = [] @users = [] if !@users # load the MUC Client if we are joining rooms. if @rooms && !@rooms.empty? require 'xmpp4r/muc' @rooms.each do |room| # handle muc messages in different rooms muc = Jabber::MUC::MUCClient.new(@client) muc.join(room) @mucs << muc end # @rooms.each end # if @rooms end