Class: LogStash::Outputs::Irc
- Defined in:
- lib/logstash/outputs/irc.rb
Overview
Write events to IRC
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
#receive(event) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/logstash/outputs/irc.rb', line 71 def receive(event) return unless output?(event) @logger.debug("Sending message to channels", :event => event) text = event.sprintf(@format) @bot.channels.each do |channel| @logger.debug("Sending to...", :channel => channel, :text => text) channel.msg(text) end # channels.each end |
#register ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/logstash/outputs/irc.rb', line 47 def register require "cinch" @irc_queue = Queue.new @logger.info("Connecting to irc server", :host => @host, :port => @port, :nick => @nick, :channels => @channels) @bot = Cinch::Bot.new @bot.loggers.clear @bot.configure do |c| c.server = @host c.port = @port c.nick = @nick c.user = @user c.realname = @real c.channels = @channels c.password = @password.value rescue nil c.ssl.use = @secure c. = @messages_per_second if @messages_per_second end Thread.new(@bot) do |bot| bot.start end end |