logstash-input-log4j 2.0.2-java → 2.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcb395d5fc55f0c24ea2ea791a30428cfa9d297e
4
- data.tar.gz: 620c01374174a2210ea969620b1627c6ef79fce6
3
+ metadata.gz: 945e2806f2a50edaf4c8576103998d3bc2ba8372
4
+ data.tar.gz: 565249091a9afc20cc6a73dd13777b007e545bbc
5
5
  SHA512:
6
- metadata.gz: f4411ed31f75ba6c223a11c5f9f625cec3232e74221ba46f2025b2e3eb0dc51ea3a83b17ef4d331249182711e40c71c44a64e70aa1c9e41a3ddcbbbb51a84ae5
7
- data.tar.gz: efe22e5b460a4a5ccb8ea6d0416a6278496a3277a52339a8692fd451114979da4a6c5ad87cd5b8421ee6316f7bf289eddc49b6b159a9370dffa43a9579f072db
6
+ metadata.gz: 66fc5a0768a5c0bae0bf9c6253bc41c22578a6ed00f441f68c8376d79201fca31df51eb01e3c893af14dab8d170a3f139ea88ee83ff753a19aa11f527fd81888
7
+ data.tar.gz: 786307fcd028e1f68e7fc88cb3045ac1afaa2a8c87e5ae77874615c6d337e60129bd30b0a1f5581cc1533621685edcf5000b21fbbcde0af87037d319527359ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 2.0.3
2
+ - Refactor code to improve test reliability
1
3
  ## 2.0.2
2
4
  - Fix tests with `Thread.abort_on_exception` turn on
3
5
  ## 2.0.0
@@ -153,7 +153,7 @@ class LogStash::Inputs::Log4j < LogStash::Inputs::Base
153
153
  if server?
154
154
  while !stop?
155
155
  Thread.start(@server_socket.accept) do |s|
156
- s.instance_eval { class << self; include ::LogStash::Util::SocketPeer end }
156
+ add_socket_mixin(s)
157
157
  @logger.debug? && @logger.debug("Accepted connection", :client => s.peer,
158
158
  :server => "#{@host}:#{@port}")
159
159
  handle_socket(s, output_queue)
@@ -161,12 +161,21 @@ class LogStash::Inputs::Log4j < LogStash::Inputs::Base
161
161
  end # loop
162
162
  else
163
163
  while !stop?
164
- client_socket = TCPSocket.new(@host, @port)
165
- client_socket.instance_eval { class << self; include ::LogStash::Util::SocketPeer end }
164
+ client_socket = build_client_socket
166
165
  @logger.debug? && @logger.debug("Opened connection", :client => "#{client_socket.peer}")
167
166
  handle_socket(client_socket, output_queue)
168
167
  end # loop
169
168
  end
170
169
  rescue IOError
171
170
  end # def run
171
+
172
+ def build_client_socket
173
+ s = TCPSocket.new(@host, @port)
174
+ add_socket_mixin(s)
175
+ s
176
+ end
177
+
178
+ def add_socket_mixin(socket)
179
+ socket.instance_eval { class << self; include ::LogStash::Util::SocketPeer end }
180
+ end
172
181
  end # class LogStash::Inputs::Log4j
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-log4j'
4
- s.version = '2.0.2'
4
+ s.version = '2.0.3'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Read events over a TCP socket from a Log4j SocketAppender"
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/plugin install gemname. This gem is not a stand-alone program"
@@ -27,7 +27,7 @@ describe LogStash::Inputs::Log4j do
27
27
  allow(socket).to receive(:peer).and_return("localhost")
28
28
  allow(socket).to receive(:close).and_return(true)
29
29
  allow(ois).to receive(:readObject).and_return({})
30
- allow(TCPSocket).to receive(:new).and_return(socket)
30
+ allow(subject).to receive(:build_client_socket).and_return(socket)
31
31
  expect(subject).to receive(:socket_to_inputstream).with(socket).and_return(ois)
32
32
  expect(subject).to receive(:create_event).and_return(LogStash::Event.new).at_least(:once)
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-log4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-08 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement