logstash-input-irc 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/logstash/inputs/irc.rb +15 -10
- data/logstash-input-irc.gemspec +1 -1
- data/spec/inputs/irc_spec.rb +17 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c61c7494644d96e7f3e5501d46712ace4228ff2b2bcf5cfabf93098eca16c0b9
|
4
|
+
data.tar.gz: 40a95b5e27c74dcbcd7ff78f999818aa3a1396c03d9b873cb06b7cd352b3ee57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3537b0a6d751872c48fdd403d47855e764a7aa83602a81587dba50c8c03858c0c9862f0cbec759e7957990396bc42265c40b3ef617df2c440211283705c0a71e
|
7
|
+
data.tar.gz: b32a07533cbcd777f7f47e45444e6fcb780041871e9161b3fe6217e6845d8203133aed0e84a61c112454917b95a000a5eb14c32d656910775281455dd6d45d9c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 3.0.6
|
2
|
+
- Fix bug where a connection to an idle IRC channel consumed 100% available CPU
|
3
|
+
- Fix issue where a message that did not contain a user's hostname could cause irc input to hang or crash
|
4
|
+
- Fix issue where IRC bots could be left running after a pipeline reload
|
5
|
+
|
1
6
|
## 3.0.5
|
2
7
|
- Update gemspec summary
|
3
8
|
|
data/lib/logstash/inputs/irc.rb
CHANGED
@@ -4,6 +4,9 @@ require "logstash/namespace"
|
|
4
4
|
require "thread"
|
5
5
|
require "stud/task"
|
6
6
|
require "stud/interval"
|
7
|
+
|
8
|
+
require "java"
|
9
|
+
|
7
10
|
# Read events from an IRC Server.
|
8
11
|
#
|
9
12
|
class LogStash::Inputs::Irc < LogStash::Inputs::Base
|
@@ -66,7 +69,7 @@ class LogStash::Inputs::Irc < LogStash::Inputs::Base
|
|
66
69
|
def register
|
67
70
|
require "cinch"
|
68
71
|
@user_stats = Hash.new
|
69
|
-
@irc_queue =
|
72
|
+
@irc_queue = java.util.concurrent.LinkedBlockingQueue.new
|
70
73
|
@catch_all = true if @get_stats
|
71
74
|
@logger.info("Connecting to irc server", :host => @host, :port => @port, :nick => @nick, :channels => @channels)
|
72
75
|
|
@@ -110,13 +113,11 @@ class LogStash::Inputs::Irc < LogStash::Inputs::Base
|
|
110
113
|
end
|
111
114
|
end
|
112
115
|
while !stop?
|
113
|
-
|
114
|
-
|
115
|
-
handle_response(msg, output_queue)
|
116
|
-
rescue ThreadError
|
117
|
-
# Empty queue
|
118
|
-
end
|
116
|
+
msg = @irc_queue.poll(1, java.util.concurrent.TimeUnit::SECONDS)
|
117
|
+
handle_response(msg, output_queue) unless msg.nil?
|
119
118
|
end
|
119
|
+
ensure
|
120
|
+
stop rescue logger.warn("irc input failed to shutdown gracefully: #{$!.message}")
|
120
121
|
end # def run
|
121
122
|
|
122
123
|
RPL_NAMREPLY = "353"
|
@@ -149,7 +150,11 @@ class LogStash::Inputs::Irc < LogStash::Inputs::Base
|
|
149
150
|
event.set("channel", msg.channel.to_s)
|
150
151
|
event.set("nick", msg.user.nick)
|
151
152
|
event.set("server", "#{@host}:#{@port}")
|
152
|
-
|
153
|
+
# The user's host attribute is an optional part of the message format;
|
154
|
+
# when it is not included, `Cinch::User#host` times out waiting for it
|
155
|
+
# to be populated, raising an exception; use `Cinch::User#data` to get
|
156
|
+
# host, which includes the user attributes as-parsed.
|
157
|
+
event.set("host", msg.user.data[:host])
|
153
158
|
output_queue << event
|
154
159
|
end
|
155
160
|
end
|
@@ -167,7 +172,7 @@ class LogStash::Inputs::Irc < LogStash::Inputs::Base
|
|
167
172
|
end
|
168
173
|
|
169
174
|
def stop
|
170
|
-
@request_names_thread.stop! if @request_names_thread
|
171
|
-
@bot_thread.stop!
|
175
|
+
@request_names_thread.stop! if @request_names_thread && !@request_names_thread.stop?
|
176
|
+
@bot_thread.stop! if @bot_thread && !@bot_thread.stop?
|
172
177
|
end
|
173
178
|
end # class LogStash::Inputs::Irc
|
data/logstash-input-irc.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-irc'
|
4
|
-
s.version = '3.0.
|
4
|
+
s.version = '3.0.6'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Reads events from an IRC server"
|
7
7
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
data/spec/inputs/irc_spec.rb
CHANGED
@@ -33,11 +33,13 @@ describe LogStash::Inputs::Irc do
|
|
33
33
|
let(:msg) { double("message") }
|
34
34
|
let(:user) { double("user") }
|
35
35
|
|
36
|
+
let(:user_data) { { host: "host", nick: "nick"} }
|
37
|
+
|
36
38
|
before(:each) do
|
37
39
|
allow(msg).to receive(:message).and_return("message")
|
38
40
|
allow(msg).to receive(:command).and_return("command")
|
39
|
-
allow(user).to receive(:
|
40
|
-
allow(user).to receive(:nick).and_return(
|
41
|
+
allow(user).to receive(:data).and_return(user_data)
|
42
|
+
allow(user).to receive(:nick).and_return(user_data[:nick])
|
41
43
|
allow(msg).to receive(:user).and_return(user)
|
42
44
|
allow(msg).to receive(:prefix).and_return("prefix")
|
43
45
|
allow(msg).to receive(:channel).and_return("channel")
|
@@ -74,5 +76,18 @@ describe LogStash::Inputs::Irc do
|
|
74
76
|
it "receive events with nick information" do
|
75
77
|
expect(event.get("nick")).to eq("nick")
|
76
78
|
end
|
79
|
+
|
80
|
+
it "receive events with host information" do
|
81
|
+
expect(event.get("host")).to eq("host")
|
82
|
+
end
|
83
|
+
|
84
|
+
context "when host is unavailable" do
|
85
|
+
|
86
|
+
let(:user_data) { super().merge(host: nil)}
|
87
|
+
|
88
|
+
it "handles unknown host well" do
|
89
|
+
expect(event.get("host")).to be_nil
|
90
|
+
end
|
91
|
+
end
|
77
92
|
end
|
78
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,9 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
-
description: This gem is a Logstash plugin required to be installed on top of the
|
89
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
90
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
91
|
+
gem is not a stand-alone program
|
90
92
|
email: info@elastic.co
|
91
93
|
executables: []
|
92
94
|
extensions: []
|
@@ -125,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
127
|
version: '0'
|
126
128
|
requirements: []
|
127
129
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.6.13
|
129
131
|
signing_key:
|
130
132
|
specification_version: 4
|
131
133
|
summary: Reads events from an IRC server
|