logstash-input-tcp 5.0.1-java → 5.0.2-java
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/inputs/tcp.rb +7 -3
- data/spec/inputs/tcp_spec.rb +50 -9
- data/vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/{5.0.1/logstash-input-tcp-5.0.1.jar → 5.0.2/logstash-input-tcp-5.0.2.jar} +0 -0
- data/version +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 194c2ce3a58504f3d3290cc5adc7945faffd3ff6
|
4
|
+
data.tar.gz: 46faee2a86e761688e5168709c986b3f295af60c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc017846852684f7cc36c933a5d4e58b9155a778a7d23589d06e6c44f08e6eafe1c7f80b70f750188a85633b69dfbbd3b11024e26c7b6b535dab24f5c51f6ee2
|
7
|
+
data.tar.gz: f90e391609b3f666aeba6f5ba9e283239b147728d3d15674cf31bb543a240260b47337cbca9aa46012d610fee6f975eb8f4ef505ceb0be2a5f7c704059b34c2d
|
data/CHANGELOG.md
CHANGED
data/lib/logstash/inputs/tcp.rb
CHANGED
@@ -189,6 +189,7 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
|
|
189
189
|
|
190
190
|
private
|
191
191
|
|
192
|
+
RUN_LOOP_ERROR_MESSAGE="TCP input server encountered error"
|
192
193
|
def run_ssl_server()
|
193
194
|
while !stop?
|
194
195
|
begin
|
@@ -199,9 +200,12 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
|
|
199
200
|
# log error, close socket, accept next connection
|
200
201
|
@logger.debug? && @logger.debug("SSL Error", :exception => e, :backtrace => e.backtrace)
|
201
202
|
rescue => e
|
202
|
-
|
203
|
-
|
204
|
-
|
203
|
+
@logger.error(
|
204
|
+
RUN_LOOP_ERROR_MESSAGE,
|
205
|
+
:message => e.message,
|
206
|
+
:class => e.class.name,
|
207
|
+
:backtrace => e.backtrace
|
208
|
+
)
|
205
209
|
end
|
206
210
|
end
|
207
211
|
ensure
|
data/spec/inputs/tcp_spec.rb
CHANGED
@@ -15,6 +15,20 @@ require_relative "../spec_helper"
|
|
15
15
|
#Cabin::Channel.get(LogStash).level = :debug
|
16
16
|
describe LogStash::Inputs::Tcp do
|
17
17
|
|
18
|
+
def get_port
|
19
|
+
begin
|
20
|
+
# Start high to better avoid common services
|
21
|
+
port = rand(10000..65535)
|
22
|
+
s = TCPServer.new("127.0.0.1", port)
|
23
|
+
s.close
|
24
|
+
return port
|
25
|
+
rescue Errno::EADDRINUSE
|
26
|
+
retry
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:port) { get_port }
|
31
|
+
|
18
32
|
context "codec (PR #1372)" do
|
19
33
|
it "switches from plain to line" do
|
20
34
|
require "logstash/codecs/plain"
|
@@ -36,7 +50,6 @@ describe LogStash::Inputs::Tcp do
|
|
36
50
|
|
37
51
|
it "should read plain with unicode" do
|
38
52
|
event_count = 10
|
39
|
-
port = rand(1024..65535)
|
40
53
|
conf = <<-CONFIG
|
41
54
|
input {
|
42
55
|
tcp {
|
@@ -69,12 +82,11 @@ describe LogStash::Inputs::Tcp do
|
|
69
82
|
|
70
83
|
it "should handle PROXY protocol v1 connections" do
|
71
84
|
event_count = 10
|
72
|
-
port = rand(1024..65535)
|
73
85
|
conf = <<-CONFIG
|
74
86
|
input {
|
75
87
|
tcp {
|
76
|
-
port => #{port}
|
77
88
|
proxy_protocol => true
|
89
|
+
port => '#{port}'
|
78
90
|
}
|
79
91
|
}
|
80
92
|
CONFIG
|
@@ -104,7 +116,6 @@ describe LogStash::Inputs::Tcp do
|
|
104
116
|
end
|
105
117
|
|
106
118
|
it "should read events with plain codec and ISO-8859-1 charset" do
|
107
|
-
port = rand(1024..65535)
|
108
119
|
charset = "ISO-8859-1"
|
109
120
|
conf = <<-CONFIG
|
110
121
|
input {
|
@@ -132,7 +143,6 @@ describe LogStash::Inputs::Tcp do
|
|
132
143
|
end
|
133
144
|
|
134
145
|
it "should read events with json codec" do
|
135
|
-
port = rand(1024..65535)
|
136
146
|
conf = <<-CONFIG
|
137
147
|
input {
|
138
148
|
tcp {
|
@@ -167,7 +177,6 @@ describe LogStash::Inputs::Tcp do
|
|
167
177
|
end
|
168
178
|
|
169
179
|
it "should read events with json codec (testing 'host' handling)" do
|
170
|
-
port = rand(1024..65535)
|
171
180
|
conf = <<-CONFIG
|
172
181
|
input {
|
173
182
|
tcp {
|
@@ -194,7 +203,6 @@ describe LogStash::Inputs::Tcp do
|
|
194
203
|
end
|
195
204
|
|
196
205
|
it "should read events with json_lines codec" do
|
197
|
-
port = rand(1024..65535)
|
198
206
|
conf = <<-CONFIG
|
199
207
|
input {
|
200
208
|
tcp {
|
@@ -233,7 +241,6 @@ describe LogStash::Inputs::Tcp do
|
|
233
241
|
|
234
242
|
it "should one message per connection" do
|
235
243
|
event_count = 10
|
236
|
-
port = rand(1024..65535)
|
237
244
|
conf = <<-CONFIG
|
238
245
|
input {
|
239
246
|
tcp {
|
@@ -271,7 +278,6 @@ describe LogStash::Inputs::Tcp do
|
|
271
278
|
srand(RSpec.configuration.seed)
|
272
279
|
end
|
273
280
|
|
274
|
-
let(:port) { rand(1024..65535) }
|
275
281
|
subject { LogStash::Plugin.lookup("input", "tcp").new({ "port" => port }) }
|
276
282
|
let!(:helper) { TcpHelpers.new }
|
277
283
|
|
@@ -348,6 +354,41 @@ describe LogStash::Inputs::Tcp do
|
|
348
354
|
end
|
349
355
|
end
|
350
356
|
|
357
|
+
describe "an error occurs during an accept" do
|
358
|
+
let(:socket) { double("socket").as_null_object }
|
359
|
+
|
360
|
+
before do
|
361
|
+
allow(input).to receive(:server_socket).and_return(socket)
|
362
|
+
|
363
|
+
allow(socket).to receive(:accept) do |a1, a2, a3|
|
364
|
+
raise StandardError, "blah"
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
it "should log the error on accept" do
|
369
|
+
allow(input.logger).to receive(:error).with(any_args)
|
370
|
+
|
371
|
+
stop = Thread.new {
|
372
|
+
sleep 2
|
373
|
+
input.do_stop
|
374
|
+
}
|
375
|
+
expect do
|
376
|
+
input.run(Queue.new)
|
377
|
+
end.not_to raise_error
|
378
|
+
|
379
|
+
expect(input.logger).to have_received(:error).with(
|
380
|
+
::LogStash::Inputs::Tcp::RUN_LOOP_ERROR_MESSAGE,
|
381
|
+
:message => "blah",
|
382
|
+
:class => "StandardError",
|
383
|
+
:backtrace => anything
|
384
|
+
).at_least(:once)
|
385
|
+
|
386
|
+
stop.join
|
387
|
+
# Wait for stop to actually happen
|
388
|
+
sleep 1
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
351
392
|
context "that sends garbage instead of TLS handshake" do
|
352
393
|
let!(:input_task) { Stud::Task.new { input.run(queue) } }
|
353
394
|
let(:max_length) { 1000 }
|
Binary file
|
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.0.
|
1
|
+
5.0.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-tcp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +147,7 @@ files:
|
|
147
147
|
- logstash-input-tcp.gemspec
|
148
148
|
- spec/inputs/tcp_spec.rb
|
149
149
|
- spec/spec_helper.rb
|
150
|
-
- vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/5.0.
|
150
|
+
- vendor/jar-dependencies/org/logstash/inputs/logstash-input-tcp/5.0.2/logstash-input-tcp-5.0.2.jar
|
151
151
|
- version
|
152
152
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
153
153
|
licenses:
|