logstash-output-nsq 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 35b00b08773bc1af2a9cd07acacb8e67b644344f
4
+ data.tar.gz: daad637c144604484e181c0606ec81d2459a9a6f
5
+ SHA512:
6
+ metadata.gz: db576cfe0e44d98f76c4e357036da78208b5ad39a2e98c2a132c7fce91579ab14f13f2c78a13829129fe5f0784c6f27e0393afba91ae5fb39d8b5389b1f3cd19
7
+ data.tar.gz: 94d364d08e5a8ae7768b70cc8d4c111f4477eef0d53e2d2da857f6c21f1e3e7167c4b8f52fe3bfe395245b1a742b7f0961a492c4d4759d48c37d8f9a5e04fca8
data/CHANGELOG.md ADDED
File without changes
data/CONTRIBUTORS ADDED
@@ -0,0 +1,11 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Aaron Mildenstein (untergeek)
6
+ * Pier-Hugues Pellerin (ph)
7
+
8
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
9
+ Logstash, and you aren't on the list above and want to be, please let us know
10
+ and we'll make sure you're here. Contributions from folks like you are what make
11
+ open source awesome.
data/DEVELOPER.md ADDED
@@ -0,0 +1,36 @@
1
+ logstash-output-nsq
2
+ ====================
3
+
4
+ NSQ output Plugin for Logstash. This output will produce messages to a nsq topic using nsq-ruby.
5
+
6
+ For more information about NSQ, refer to this [documentation](http://nsq.io)
7
+
8
+ Logstash Configuration
9
+ ====================
10
+
11
+ Using a static NSQD:
12
+ ====================
13
+
14
+ output {
15
+ nsq {
16
+ nsqd => 127.0.0.1:4150"
17
+ topic => "testtopic"
18
+ }
19
+ }
20
+
21
+
22
+
23
+ Using NSQLOOKUPD to find nsqd servers for the given topic:
24
+ ====================
25
+
26
+ output {
27
+ nsq {
28
+ nsqlookupd => ["127.0.0.1:4161","1.2.3.4:4161"]
29
+ topic => "testtopic"
30
+ }
31
+ }
32
+
33
+ Dependencies
34
+ ====================
35
+
36
+ * nsq-ruby
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012–2015 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ logstash-output-nsq
2
+ ====================
3
+
4
+ NSQ output Plugin for Logstash. This output will produce messages to a nsq topic using nsq-ruby.
5
+
6
+ For more information about NSQ, refer to this [documentation](http://nsq.io)
7
+
8
+ Logstash Configuration
9
+ ====================
10
+
11
+ Using a static NSQD:
12
+ ====================
13
+
14
+ output {
15
+ nsq {
16
+ nsqd => 127.0.0.1:4150"
17
+ topic => "testtopic"
18
+ }
19
+ }
20
+
21
+
22
+
23
+ Using NSQLOOKUPD to find nsqd servers for the given topic:
24
+ ====================
25
+
26
+ output {
27
+ nsq {
28
+ nsqlookupd => ["127.0.0.1:4161","1.2.3.4:4161"]
29
+ topic => "testtopic"
30
+ }
31
+ }
32
+
33
+ Dependencies
34
+ ====================
35
+
36
+ * nsq-ruby
37
+
38
+ # Logstash Plugin
39
+
40
+ This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
41
+
42
+ 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.
43
+
44
+ ## Documentation
45
+
46
+ 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.elasticsearch.org/guide/en/logstash/current/).
47
+
48
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
49
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
50
+
51
+ ## Need Help?
52
+
53
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
54
+
55
+ ## Developing
56
+
57
+ ### 1. Plugin Developement and Testing
58
+
59
+ #### Code
60
+ - To get started, you'll need JRuby with the Bundler gem installed.
61
+
62
+ - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
63
+
64
+ - Install dependencies
65
+ ```sh
66
+ bundle install
67
+ ```
68
+
69
+ #### Test
70
+
71
+ - Update your dependencies
72
+
73
+ ```sh
74
+ bundle install
75
+ ```
76
+
77
+ - Run tests
78
+
79
+ ```sh
80
+ bundle exec rspec
81
+ ```
82
+
83
+ ### 2. Running your unpublished Plugin in Logstash
84
+
85
+ #### 2.1 Run in a local Logstash clone
86
+
87
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
88
+ ```ruby
89
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
90
+ ```
91
+ - Install plugin
92
+ ```sh
93
+ bin/plugin install --no-verify
94
+ ```
95
+ - Run Logstash with your plugin
96
+ ```sh
97
+ bin/logstash -e 'filter {awesome {}}'
98
+ ```
99
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
100
+
101
+ #### 2.2 Run in an installed Logstash
102
+
103
+ You can use the same **2.1** method to run your plugin in an installed Logstash by editing its `Gemfile` and pointing the `:path` to your local plugin development directory or you can build the gem and install it using:
104
+
105
+ - Build your plugin gem
106
+ ```sh
107
+ gem build logstash-filter-awesome.gemspec
108
+ ```
109
+ - Install the plugin from the Logstash home
110
+ ```sh
111
+ bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
112
+ ```
113
+ - Start Logstash and proceed to test the plugin
114
+
115
+ ## Contributing
116
+
117
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
118
+
119
+ Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.
120
+
121
+ It is more important to the community that you are able to contribute.
122
+
123
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rake"
@@ -0,0 +1,53 @@
1
+ require 'logstash/namespace'
2
+ require 'logstash/outputs/base'
3
+ require 'nsq'
4
+
5
+ class LogStash::Outputs::Nsq < LogStash::Outputs::Base
6
+ config_name 'nsq'
7
+
8
+ default :codec, 'json'
9
+ config :nsqd, :validate => :string, :default => nil
10
+ config :nsqlookupd, :validate => :array, :default => nil
11
+ config :topic, :validate => :string, :required => true
12
+
13
+ public
14
+ def register
15
+ options = {
16
+ :nsqlookupd => @nsqlookupd,
17
+ :topic => @topic,
18
+ }
19
+ if nsqlookupd == []
20
+ options = {
21
+ :nsqd => @nsqd,
22
+ :topic => @topic,
23
+ }
24
+ end # if
25
+ @producer = Nsq::Producer.new(options)
26
+ #@producer.connect
27
+ @logger.info('Registering nsq producer', :nsqd => @nsqd, :nsqlookupd => @nsqlookupd, :topic => @topic)
28
+
29
+ @codec.on_event do |event, data|
30
+ begin
31
+ @producer.write(event.sprintf(data))
32
+ rescue LogStash::ShutdownSignal
33
+ @logger.info('nsq producer got shutdown signal')
34
+ rescue => e
35
+ @logger.warn('nsq producer threw exception, restarting',
36
+ :exception => e)
37
+ end # begin
38
+ end #do
39
+ end # def register
40
+
41
+ def receive(event)
42
+ return unless output?(event)
43
+ if event == LogStash::SHUTDOWN
44
+ finished
45
+ return
46
+ end
47
+ @codec.encode(event)
48
+ end # def receive
49
+
50
+ def teardown
51
+ @producer.terminate
52
+ end
53
+ end #class LogStash::Outputs::Nsq
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-output-nsq'
3
+ s.version = "1.0.0"
4
+ s.licenses = ["Apache License (2.0)"]
5
+ s.summary = "this logstash plugin outputs in a nsq topic"
6
+ 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"
7
+ s.authors = ["Matthias Schneider"]
8
+ s.email = "ms@wck.biz"
9
+ s.homepage = "https://github.com/mschneider82/logstash-output-nsq"
10
+ s.require_paths = ["lib"]
11
+
12
+ # Files
13
+ s.files = `git ls-files`.split($\)
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
19
+
20
+ # Gem dependencies
21
+ s.add_runtime_dependency "logstash-core", ">= 1.4.0", "< 2.0.0"
22
+ s.add_runtime_dependency "logstash-codec-plain"
23
+ s.add_runtime_dependency "nsq-ruby"
24
+ s.add_development_dependency "logstash-devutils"
25
+ end
@@ -0,0 +1,21 @@
1
+ require "logstash/devutils/rspec/spec_helper"
2
+ require "logstash/outputs/nsq"
3
+ require "logstash/codecs/plain"
4
+ require "logstash/event"
5
+
6
+ #describe LogStash::Outputs::Nsq do
7
+ # let(:sample_event) { LogStash::Event.new }
8
+ # let(:output) { LogStash::Outputs::Nsq.new }
9
+ #
10
+ # before do
11
+ # output.register
12
+ # end
13
+ #
14
+ # describe "receive message" do
15
+ # subject { output.receive(sample_event) }
16
+ #
17
+ # it "returns a string" do
18
+ # expect(subject).to eq("Event received")
19
+ # end
20
+ # end
21
+ #end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-output-nsq
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthias Schneider
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: logstash-core
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.4.0
28
+ - - <
29
+ - !ruby/object:Gem::Version
30
+ version: 2.0.0
31
+ prerelease: false
32
+ type: :runtime
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'
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ prerelease: false
46
+ type: :runtime
47
+ - !ruby/object:Gem::Dependency
48
+ name: nsq-ruby
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ prerelease: false
60
+ type: :runtime
61
+ - !ruby/object:Gem::Dependency
62
+ name: logstash-devutils
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirement: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ prerelease: false
74
+ type: :development
75
+ 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
76
+ email: ms@wck.biz
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - CHANGELOG.md
82
+ - CONTRIBUTORS
83
+ - DEVELOPER.md
84
+ - Gemfile
85
+ - LICENSE
86
+ - NOTICE.TXT
87
+ - README.md
88
+ - Rakefile
89
+ - lib/logstash/outputs/nsq.rb
90
+ - logstash-output-nsq.gemspec
91
+ - spec/outputs/example_spec.rb
92
+ homepage: https://github.com/mschneider82/logstash-output-nsq
93
+ licenses:
94
+ - Apache License (2.0)
95
+ metadata:
96
+ logstash_plugin: 'true'
97
+ logstash_group: output
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.4.5
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: this logstash plugin outputs in a nsq topic
118
+ test_files:
119
+ - spec/outputs/example_spec.rb