logstash-input-relp 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/inputs/relp.rb +15 -15
- data/logstash-input-relp.gemspec +1 -1
- data/spec/inputs/relp_spec.rb +19 -28
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f136b2ae376bb7219926bbb97ea97be2314757a
|
4
|
+
data.tar.gz: 0aa28fa74ee6ceba4e3713e488d971d8fe1c2cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d3a95308a7672189db3c7e828f2036f87a146da7810ebbf32d6ed8bf13909ded0db77391f38a6cb9d57d8c625e87ba40d450b9084a4df7de3dbbcaf0bc0ee9e
|
7
|
+
data.tar.gz: 6884706af0e0574ef7257a3fb65cd70d593d510eaf3faaebf79ba7902aa3266740b29ee0d24e189bb565f4c5da77d2102f9b720182cddac4a2647561f9bc42f7
|
data/lib/logstash/inputs/relp.rb
CHANGED
@@ -8,7 +8,7 @@ require "logstash/util/socket_peer"
|
|
8
8
|
|
9
9
|
# Read RELP events over a TCP socket.
|
10
10
|
#
|
11
|
-
# For more information about RELP, see
|
11
|
+
# For more information about RELP, see
|
12
12
|
# <http://www.rsyslog.com/doc/imrelp.html>
|
13
13
|
#
|
14
14
|
# This protocol implements application-level acknowledgements to help protect
|
@@ -17,8 +17,6 @@ require "logstash/util/socket_peer"
|
|
17
17
|
# Message acks only function as far as messages being put into the queue for
|
18
18
|
# filters; anything lost after that point will not be retransmitted
|
19
19
|
class LogStash::Inputs::Relp < LogStash::Inputs::Base
|
20
|
-
class Interrupted < StandardError; end
|
21
|
-
|
22
20
|
config_name "relp"
|
23
21
|
|
24
22
|
default :codec, "plain"
|
@@ -31,6 +29,8 @@ class LogStash::Inputs::Relp < LogStash::Inputs::Base
|
|
31
29
|
|
32
30
|
def initialize(*args)
|
33
31
|
super(*args)
|
32
|
+
@interrupted = false
|
33
|
+
@relp_server = nil
|
34
34
|
end # def initialize
|
35
35
|
|
36
36
|
public
|
@@ -49,7 +49,7 @@ class LogStash::Inputs::Relp < LogStash::Inputs::Base
|
|
49
49
|
output_queue << event
|
50
50
|
end
|
51
51
|
|
52
|
-
#To get this far, the message must have made it into the queue for
|
52
|
+
#To get this far, the message must have made it into the queue for
|
53
53
|
#filtering. I don't think it's possible to wait for output before ack
|
54
54
|
#without fundamentally breaking the plugin architecture
|
55
55
|
relpserver.ack(socket, frame['txnr'])
|
@@ -59,7 +59,7 @@ class LogStash::Inputs::Relp < LogStash::Inputs::Base
|
|
59
59
|
public
|
60
60
|
def run(output_queue)
|
61
61
|
@thread = Thread.current
|
62
|
-
|
62
|
+
while !@interrupted
|
63
63
|
begin
|
64
64
|
# Start a new thread for each connection.
|
65
65
|
Thread.start(@relp_server.accept) do |client|
|
@@ -87,22 +87,22 @@ class LogStash::Inputs::Relp < LogStash::Inputs::Base
|
|
87
87
|
@logger.warn('Relp client trying to open connection with something other than open:'+e.message)
|
88
88
|
rescue Relp::InsufficientCommands
|
89
89
|
@logger.warn('Relp client incapable of syslog')
|
90
|
-
rescue IOError
|
91
|
-
if @interrupted
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
# Else it was a genuine IOError caused by something else, so propagate it up..
|
97
|
-
raise
|
98
|
-
end
|
90
|
+
rescue IOError
|
91
|
+
break if @interrupted
|
92
|
+
raise
|
93
|
+
rescue LogStash::ShutdownSignal
|
94
|
+
@interrupted = true
|
95
|
+
break
|
99
96
|
end
|
100
97
|
end # loop
|
101
98
|
end # def run
|
102
99
|
|
103
100
|
def teardown
|
104
101
|
@interrupted = true
|
105
|
-
@
|
102
|
+
if @relp_server
|
103
|
+
@relp_server.shutdown rescue nil
|
104
|
+
@relp_server = nil
|
105
|
+
end
|
106
106
|
end
|
107
107
|
end # class LogStash::Inputs::Relp
|
108
108
|
|
data/logstash-input-relp.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-relp'
|
4
|
-
s.version = '0.1.
|
4
|
+
s.version = '0.1.4'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Read RELP events over a TCP socket."
|
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"
|
data/spec/inputs/relp_spec.rb
CHANGED
@@ -3,12 +3,12 @@ require "logstash/devutils/rspec/spec_helper"
|
|
3
3
|
require "socket"
|
4
4
|
require "logstash/util/relp"
|
5
5
|
|
6
|
-
describe "inputs/relp"
|
6
|
+
describe "inputs/relp" do
|
7
7
|
|
8
|
-
|
8
|
+
it "should do single client connection" do
|
9
9
|
event_count = 10
|
10
10
|
port = 5511
|
11
|
-
|
11
|
+
conf = <<-CONFIG
|
12
12
|
input {
|
13
13
|
relp {
|
14
14
|
type => "blah"
|
@@ -17,29 +17,23 @@ describe "inputs/relp", :socket => true do
|
|
17
17
|
}
|
18
18
|
CONFIG
|
19
19
|
|
20
|
-
input do |pipeline, queue|
|
21
|
-
th = Thread.new { pipeline.run }
|
22
|
-
sleep 0.1 while !pipeline.ready?
|
23
|
-
|
24
|
-
#Send events from clients
|
20
|
+
events = input(conf) do |pipeline, queue|
|
25
21
|
client = RelpClient.new("0.0.0.0", port, ["syslog"])
|
26
22
|
event_count.times do |value|
|
27
23
|
client.syslog_write("Hello #{value}")
|
28
24
|
end
|
25
|
+
event_count.times.collect { queue.pop }
|
26
|
+
end
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
pipeline.shutdown
|
36
|
-
th.join
|
37
|
-
end # input
|
28
|
+
event_count.times do |i|
|
29
|
+
insist { events[i]["message"] } == "Hello #{i}"
|
30
|
+
end
|
38
31
|
end
|
39
|
-
|
32
|
+
|
33
|
+
it "should do two client connection" do
|
40
34
|
event_count = 100
|
41
35
|
port = 5512
|
42
|
-
|
36
|
+
conf = <<-CONFIG
|
43
37
|
input {
|
44
38
|
relp {
|
45
39
|
type => "blah"
|
@@ -48,22 +42,19 @@ describe "inputs/relp", :socket => true do
|
|
48
42
|
}
|
49
43
|
CONFIG
|
50
44
|
|
51
|
-
input do |pipeline, queue|
|
52
|
-
Thread.new { pipeline.run }
|
53
|
-
sleep 0.1 while !pipeline.ready?
|
54
|
-
|
55
|
-
#Send events from clients sockets
|
45
|
+
events = input(conf) do |pipeline, queue|
|
56
46
|
client = RelpClient.new("0.0.0.0", port, ["syslog"])
|
57
47
|
client2 = RelpClient.new("0.0.0.0", port, ["syslog"])
|
58
48
|
|
59
|
-
event_count.times do
|
49
|
+
event_count.times do
|
60
50
|
client.syslog_write("Hello from client")
|
61
51
|
client2.syslog_write("Hello from client 2")
|
62
52
|
end
|
63
53
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
54
|
+
(event_count * 2).times.map{queue.pop}
|
55
|
+
end
|
56
|
+
|
57
|
+
insist { events.select{|event| event["message"] == "Hello from client" }.size } == event_count
|
58
|
+
insist { events.select{|event| event["message"] == "Hello from client 2" }.size } == event_count
|
68
59
|
end
|
69
60
|
end
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-relp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elasticsearch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
14
|
+
name: logstash-core
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - '>='
|
17
18
|
- !ruby/object:Gem::Version
|
@@ -19,10 +20,7 @@ dependencies:
|
|
19
20
|
- - <
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 2.0.0
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
type: :runtime
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
26
24
|
requirements:
|
27
25
|
- - '>='
|
28
26
|
- !ruby/object:Gem::Version
|
@@ -30,34 +28,36 @@ dependencies:
|
|
30
28
|
- - <
|
31
29
|
- !ruby/object:Gem::Version
|
32
30
|
version: 2.0.0
|
31
|
+
prerelease: false
|
32
|
+
type: :runtime
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
+
name: logstash-codec-plain
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
34
40
|
requirement: !ruby/object:Gem::Requirement
|
35
41
|
requirements:
|
36
42
|
- - '>='
|
37
43
|
- !ruby/object:Gem::Version
|
38
44
|
version: '0'
|
39
|
-
name: logstash-codec-plain
|
40
45
|
prerelease: false
|
41
46
|
type: :runtime
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: logstash-devutils
|
42
49
|
version_requirements: !ruby/object:Gem::Requirement
|
43
50
|
requirements:
|
44
51
|
- - '>='
|
45
52
|
- !ruby/object:Gem::Version
|
46
53
|
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
54
|
requirement: !ruby/object:Gem::Requirement
|
49
55
|
requirements:
|
50
56
|
- - '>='
|
51
57
|
- !ruby/object:Gem::Version
|
52
58
|
version: '0'
|
53
|
-
name: logstash-devutils
|
54
59
|
prerelease: false
|
55
60
|
type: :development
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - '>='
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
61
|
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
|
62
62
|
email: info@elasticsearch.com
|
63
63
|
executables: []
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.1.9
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Read RELP events over a TCP socket.
|