Class: LogStash::Outputs::Xmpp
- Defined in:
- lib/logstash/outputs/xmpp.rb
Overview
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.
Constant Summary
Constants included from Config::Mixin
Instance Attribute Summary
Attributes included from Config::Mixin
Attributes inherited from Plugin
Instance Method Summary collapse
Methods inherited from Base
#handle, #handle_worker, #initialize, #worker_setup, #workers_not_supported
Methods included from Config::Mixin
Methods inherited from Plugin
#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s
Constructor Details
This class inherits a constructor from LogStash::Outputs::Base
Instance Method Details
#connect ⇒ Object
53 54 55 56 57 58 59 |
# 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) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/logstash/outputs/xmpp.rb', line 62 def receive(event) return unless output?(event) = event.sprintf(@message) @users.each do |user| msg = Jabber::Message.new(user, ) msg.type = :chat @client.send(msg) end # @targets.each msg = Jabber::Message.new(nil, ) msg.type = :groupchat @mucs.each do |muc| muc.send(msg) end # @mucs.each end |
#register ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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 |