logstash-input-stomp 0.1.4 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/NOTICE.TXT +5 -0
- data/README.md +5 -5
- data/lib/logstash/inputs/stomp.rb +20 -11
- data/logstash-input-stomp.gemspec +3 -3
- data/spec/inputs/stomp_spec.rb +14 -0
- metadata +9 -9
- data/.gitignore +0 -4
- data/Rakefile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80605f7108b894b050ba277624e41b03f2bd3826
|
4
|
+
data.tar.gz: 0fe3f542744774573c583e0463256147aef136f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 274b5513205452f5da29daf1c3ef87ac970802fca20b5fdb5924f1279a77c20801e3148547d5230573d5e634033b5414c378a654bb3b11009842ffc4b2242a3c
|
7
|
+
data.tar.gz: cfa592e611861617de36c27fa01f04ab22b2bb85430519cfad67c8213f9e496cc7ac4445b8bb38d163141dcdee8e7a0bb8922285b44c3c1b968b5903fdd13bb0
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
## 2.0.0
|
2
|
+
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
|
3
|
+
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
|
4
|
+
- Dependency on logstash-core update to 2.0
|
5
|
+
|
data/NOTICE.TXT
ADDED
data/README.md
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
This is a plugin for [Logstash](https://github.com/
|
3
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
4
4
|
|
5
5
|
It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
|
6
6
|
|
7
7
|
## Documentation
|
8
8
|
|
9
|
-
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.
|
9
|
+
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
|
10
10
|
|
11
11
|
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
12
|
-
- For more asciidoc formatting tips, see the excellent reference here https://github.com/
|
12
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
13
13
|
|
14
14
|
## Need Help?
|
15
15
|
|
16
|
-
Need help? Try #logstash on freenode IRC or the logstash
|
16
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
17
17
|
|
18
18
|
## Developing
|
19
19
|
|
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
|
|
83
83
|
|
84
84
|
It is more important to the community that you are able to contribute.
|
85
85
|
|
86
|
-
For more information about contributing, see the [CONTRIBUTING](https://github.com/
|
86
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
@@ -3,8 +3,9 @@ require "logstash/inputs/base"
|
|
3
3
|
require "logstash/namespace"
|
4
4
|
require 'pp'
|
5
5
|
|
6
|
-
|
7
6
|
class LogStash::Inputs::Stomp < LogStash::Inputs::Base
|
7
|
+
attr_accessor :client
|
8
|
+
|
8
9
|
config_name "stomp"
|
9
10
|
|
10
11
|
default :codec, "plain"
|
@@ -35,33 +36,39 @@ class LogStash::Inputs::Stomp < LogStash::Inputs::Base
|
|
35
36
|
private
|
36
37
|
def connect
|
37
38
|
begin
|
38
|
-
|
39
|
-
@logger.debug("Connected to stomp server") if
|
39
|
+
client.connect
|
40
|
+
@logger.debug("Connected to stomp server") if client.connected?
|
40
41
|
rescue => e
|
41
42
|
@logger.debug("Failed to connect to stomp server, will retry", :exception => e, :backtrace => e.backtrace)
|
42
|
-
|
43
|
-
|
43
|
+
if stop?
|
44
|
+
sleep 2
|
45
|
+
retry
|
46
|
+
end
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
47
50
|
public
|
48
51
|
def register
|
49
52
|
require "onstomp"
|
50
|
-
|
51
|
-
|
53
|
+
client = new_client
|
54
|
+
client.host = @vhost if @vhost
|
52
55
|
@stomp_url = "stomp://#{@user}:#{@password}@#{@host}:#{@port}/#{@destination}"
|
53
56
|
|
54
57
|
# Handle disconnects
|
55
|
-
|
58
|
+
client.on_connection_closed {
|
56
59
|
connect
|
57
60
|
subscription_handler # is required for re-subscribing to the destination
|
58
61
|
}
|
59
62
|
connect
|
60
63
|
end # def register
|
61
64
|
|
65
|
+
def new_client
|
66
|
+
OnStomp::Client.new("stomp://#{@host}:#{@port}", :login => @user, :passcode => @password.value)
|
67
|
+
end
|
68
|
+
|
62
69
|
private
|
63
70
|
def subscription_handler
|
64
|
-
|
71
|
+
client.subscribe(@destination) do |msg|
|
65
72
|
@codec.decode(msg.body) do |event|
|
66
73
|
decorate(event)
|
67
74
|
@output_queue << event
|
@@ -72,8 +79,10 @@ class LogStash::Inputs::Stomp < LogStash::Inputs::Base
|
|
72
79
|
#the flow control to the 'run' method below. After that, the
|
73
80
|
#method "run_input" from agent.rb marks 'done' as 'true' and calls
|
74
81
|
#'finish' over the Stomp plugin instance.
|
75
|
-
#'Sleeping' the plugin
|
76
|
-
|
82
|
+
#'Sleeping' the plugin leaves the instance alive.
|
83
|
+
until stop?
|
84
|
+
sleep 1
|
85
|
+
end
|
77
86
|
end
|
78
87
|
|
79
88
|
public
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-stomp'
|
4
|
-
s.version = '0.1
|
4
|
+
s.version = '2.0.1'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Pull events from a stomp 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/plugin install gemname. This gem is not a stand-alone program"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files =
|
14
|
+
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "input" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core",
|
23
|
+
s.add_runtime_dependency "logstash-core", ">= 2.0.0.snapshot", "< 3.0.0"
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'logstash-codec-plain'
|
26
26
|
s.add_runtime_dependency 'onstomp'
|
data/spec/inputs/stomp_spec.rb
CHANGED
@@ -1 +1,15 @@
|
|
1
1
|
require "logstash/devutils/rspec/spec_helper"
|
2
|
+
require "logstash/inputs/stomp"
|
3
|
+
|
4
|
+
describe LogStash::Inputs::Stomp do
|
5
|
+
describe "stopping" do
|
6
|
+
let(:config) { {"host" => "localhost", "destination" => "/foo"} }
|
7
|
+
let(:client) { double("client") }
|
8
|
+
before do
|
9
|
+
subject.client = client
|
10
|
+
allow(subject).to receive(:connect)
|
11
|
+
allow(client).to receive(:subscribe)
|
12
|
+
end
|
13
|
+
it_behaves_like "an interruptible input plugin"
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-stomp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - '>='
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
18
|
+
version: 2.0.0.snapshot
|
19
19
|
- - <
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 3.0.0
|
22
22
|
name: logstash-core
|
23
23
|
prerelease: false
|
24
24
|
type: :runtime
|
@@ -26,10 +26,10 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 2.0.0.snapshot
|
30
30
|
- - <
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 3.0.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
@@ -78,12 +78,12 @@ executables: []
|
|
78
78
|
extensions: []
|
79
79
|
extra_rdoc_files: []
|
80
80
|
files:
|
81
|
-
- .
|
81
|
+
- CHANGELOG.md
|
82
82
|
- CONTRIBUTORS
|
83
83
|
- Gemfile
|
84
84
|
- LICENSE
|
85
|
+
- NOTICE.TXT
|
85
86
|
- README.md
|
86
|
-
- Rakefile
|
87
87
|
- lib/logstash/inputs/stomp.rb
|
88
88
|
- logstash-input-stomp.gemspec
|
89
89
|
- spec/inputs/stomp_spec.rb
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.4.8
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Pull events from a stomp server
|
data/.gitignore
DELETED