logstash-input-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: e7747deed49d4c7dd96eadb8d891df67c5c4561b
4
+ data.tar.gz: 030c13dbe332140dd16fb8503ef0a9c0d37f2213
5
+ SHA512:
6
+ metadata.gz: bdc3d0fc7869a696234a98cc6f7714255aab51dbf6b2362647f2769c9972937b9e49ce66dbe7338ad1bd6aa48093658c472d59102f38a655d9234df1fbef9ff5
7
+ data.tar.gz: 8254fb21c0160b1aad1c0ebc9944257fc9dda9e8cb30aec015f0f7d584c32d8ec60a868e0cc92092bbff2d0cf2ccaebbb03a6e300946950f71900aad8fc78728
data/CHANGELOG.md ADDED
File without changes
data/CONTRIBUTORS ADDED
@@ -0,0 +1,15 @@
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
+ * Joseph Lawson (joekiller)
6
+ * Pere Urbón (purbon)
7
+ * Pier-Hugues Pellerin (ph)
8
+ * Richard Pijnenburg (electrical)
9
+ * Suyog Rao (suyograo)
10
+ * Tal Levy (talevy)
11
+
12
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
13
+ Logstash, and you aren't on the list above and want to be, please let us know
14
+ and we'll make sure you're here. Contributions from folks like you are what make
15
+ open source awesome.
data/DEVELOPER.md ADDED
@@ -0,0 +1,22 @@
1
+ logstash-input-nsq
2
+ ====================
3
+
4
+ NSQ input for Logstash. This input will consume messages from 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
+ input {
12
+ nsq {
13
+ nsqlookupd => "127.0.0.1:4161"
14
+ topic => "testtopic"
15
+ channel => "testchannel"
16
+ }
17
+ }
18
+
19
+ Dependencies
20
+ ====================
21
+
22
+ * 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,86 @@
1
+ # Logstash Plugin
2
+
3
+ This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
4
+
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
+
7
+ ## Documentation
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.elasticsearch.org/guide/en/logstash/current/).
10
+
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/elasticsearch/docs#asciidoc-guide
13
+
14
+ ## Need Help?
15
+
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
+
18
+ ## Developing
19
+
20
+ ### 1. Plugin Developement and Testing
21
+
22
+ #### Code
23
+ - To get started, you'll need JRuby with the Bundler gem installed.
24
+
25
+ - 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).
26
+
27
+ - Install dependencies
28
+ ```sh
29
+ bundle install
30
+ ```
31
+
32
+ #### Test
33
+
34
+ - Update your dependencies
35
+
36
+ ```sh
37
+ bundle install
38
+ ```
39
+
40
+ - Run tests
41
+
42
+ ```sh
43
+ bundle exec rspec
44
+ ```
45
+
46
+ ### 2. Running your unpublished Plugin in Logstash
47
+
48
+ #### 2.1 Run in a local Logstash clone
49
+
50
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
51
+ ```ruby
52
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
53
+ ```
54
+ - Install plugin
55
+ ```sh
56
+ bin/plugin install --no-verify
57
+ ```
58
+ - Run Logstash with your plugin
59
+ ```sh
60
+ bin/logstash -e 'filter {awesome {}}'
61
+ ```
62
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
63
+
64
+ #### 2.2 Run in an installed Logstash
65
+
66
+ 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:
67
+
68
+ - Build your plugin gem
69
+ ```sh
70
+ gem build logstash-filter-awesome.gemspec
71
+ ```
72
+ - Install the plugin from the Logstash home
73
+ ```sh
74
+ bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
75
+ ```
76
+ - Start Logstash and proceed to test the plugin
77
+
78
+ ## Contributing
79
+
80
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
81
+
82
+ 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.
83
+
84
+ It is more important to the community that you are able to contribute.
85
+
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ @files=[]
2
+
3
+ task :default do
4
+ system('rake -T')
5
+ end
6
+
7
+ require "logstash/devutils/rake"
@@ -0,0 +1,62 @@
1
+ require 'logstash/namespace'
2
+ require 'logstash/inputs/base'
3
+ require 'nsq'
4
+
5
+ class LogStash::Inputs::Nsq < LogStash::Inputs::Base
6
+ config_name 'nsq'
7
+
8
+ default :codec, 'json'
9
+
10
+ config :nsqlookupd, :validate => :string, :default => 'localhost:4161'
11
+ config :channel, :validate => :string, :default => 'logstash'
12
+ config :topic, :validate => :string, :default => 'testtopic'
13
+
14
+
15
+ public
16
+ def register
17
+ @logger.info('Registering nsq', :channel => @channel, :topic => @topic, :nsqlookupd => @nsqlookupd)
18
+ end # def register
19
+
20
+ public
21
+ def run(logstash_queue)
22
+ @logger.info('Running nsq', :channel => @channel, :topic => @topic, :nsqlookupd => @nsqlookupd)
23
+ begin
24
+ begin
25
+ consumer = Nsq::Consumer.new(
26
+ :nsqlookupd => @nsqlookupd,
27
+ :topic => @topic,
28
+ :channel => @channel
29
+ )
30
+ while true
31
+ #@logger.info('consuming...')
32
+ event = consumer.pop
33
+ #@logger.info('processing:', :event => event)
34
+ queue_event(event.body, logstash_queue)
35
+ event.finish
36
+ end
37
+ rescue LogStash::ShutdownSignal
38
+ @logger.info('nsq got shutdown signal')
39
+ end
40
+ @logger.info('Done running nsq input')
41
+ rescue => e
42
+ @logger.warn('client threw exception, restarting',
43
+ :exception => e)
44
+ retry
45
+ end
46
+ finished
47
+ end # def run
48
+
49
+ private
50
+ def queue_event(body, output_queue)
51
+ begin
52
+ #@logger.info('processing:', :body => body)
53
+ event = LogStash::Event.new("message" => body, "host" => @host)
54
+ decorate(event)
55
+ output_queue << event
56
+ rescue => e # parse or event creation error
57
+ @logger.error('Failed to create event', :message => "#{body}", :exception => e,
58
+ :backtrace => e.backtrace)
59
+ end # begin
60
+ end # def queue_event
61
+
62
+ end #class LogStash::Inputs::Nsq
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-input-nsq'
4
+ s.version = '1.0.0'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = 'This input will read events from a nsq topic.'
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"
8
+ s.authors = ['Elasticsearch']
9
+ s.email = 'info@elastic.co'
10
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
11
+ s.require_paths = ["lib"]
12
+
13
+ # Files
14
+ s.files = `git ls-files`.split($\)
15
+ # Tests
16
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
+
18
+ # Special flag to let us know this is actually a logstash plugin
19
+ s.metadata = { 'logstash_plugin' => 'true', 'group' => 'input'}
20
+
21
+ # Gem dependencies
22
+ s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency 'logstash-codec-json'
24
+ s.add_runtime_dependency 'logstash-codec-plain'
25
+
26
+ s.add_runtime_dependency 'nsq-ruby'
27
+
28
+ s.add_development_dependency 'logstash-devutils'
29
+ end
30
+
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rspec/spec_helper"
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-input-nsq
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Elasticsearch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-09 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-json
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: logstash-codec-plain
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: nsq-ruby
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: :runtime
75
+ - !ruby/object:Gem::Dependency
76
+ name: logstash-devutils
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ prerelease: false
88
+ type: :development
89
+ 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
90
+ email: info@elastic.co
91
+ executables: []
92
+ extensions: []
93
+ extra_rdoc_files: []
94
+ files:
95
+ - CHANGELOG.md
96
+ - CONTRIBUTORS
97
+ - DEVELOPER.md
98
+ - Gemfile
99
+ - LICENSE
100
+ - NOTICE.TXT
101
+ - README.md
102
+ - Rakefile
103
+ - lib/logstash/inputs/nsq.rb
104
+ - logstash-input-nsq.gemspec
105
+ - spec/inputs/nsq_spec.rb
106
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
107
+ licenses:
108
+ - Apache License (2.0)
109
+ metadata:
110
+ logstash_plugin: 'true'
111
+ group: input
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ requirements: []
127
+ rubyforge_project:
128
+ rubygems_version: 2.4.5
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: This input will read events from a nsq topic.
132
+ test_files:
133
+ - spec/inputs/nsq_spec.rb