logstash-input-thisisonlyatest 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ab4cbfc60860861920d289e5d1cd69b901ad98bf
4
+ data.tar.gz: 351e525c3b3e91c6d919c558f988d9af32a91979
5
+ SHA512:
6
+ metadata.gz: ffefb8f71d5e5e30ee7a45dd7ea95c27b7ee51a3e9500c2ee431df80ae835ccceaa5af9f553260cfdc3fe6e12ce778e05fd570643a82079493c47c086310e1a6
7
+ data.tar.gz: ae3b81fa55ed0380cb223e15d5d68e7a3369c10f6fb9f9e5a9fc48fc1fbc5b0b117734c2ad69177786581da40a18ef0461d8f989423b35d2d3ccbb486f60f2d7
@@ -0,0 +1,9 @@
1
+ ## 2.0.4
2
+ - Add encoding: utf-8 line to spec file. This can prevent issues with tests.
3
+ ## 2.0.1
4
+ - Simplify the shutdown implementation a bit for easier understanding
5
+ ## 2.0.0
6
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
7
+ instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
8
+ - Dependency on logstash-core update to 2.0
9
+
@@ -0,0 +1,2 @@
1
+ # logstash-input-example
2
+ Example input plugin. This should help bootstrap your effort to write your own input plugin!
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.
@@ -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/).
@@ -0,0 +1,89 @@
1
+ # Logstash Plugin
2
+
3
+ [![Build
4
+ Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-example-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-example-unit/)
5
+
6
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
7
+
8
+ 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.
9
+
10
+ ## Documentation
11
+
12
+ 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/).
13
+
14
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
15
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
16
+
17
+ ## Need Help?
18
+
19
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
20
+
21
+ ## Developing
22
+
23
+ ### 1. Plugin Developement and Testing
24
+
25
+ #### Code
26
+ - To get started, you'll need JRuby with the Bundler gem installed.
27
+
28
+ - 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).
29
+
30
+ - Install dependencies
31
+ ```sh
32
+ bundle install
33
+ ```
34
+
35
+ #### Test
36
+
37
+ - Update your dependencies
38
+
39
+ ```sh
40
+ bundle install
41
+ ```
42
+
43
+ - Run tests
44
+
45
+ ```sh
46
+ bundle exec rspec
47
+ ```
48
+
49
+ ### 2. Running your unpublished Plugin in Logstash
50
+
51
+ #### 2.1 Run in a local Logstash clone
52
+
53
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
54
+ ```ruby
55
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
56
+ ```
57
+ - Install plugin
58
+ ```sh
59
+ bin/plugin install --no-verify
60
+ ```
61
+ - Run Logstash with your plugin
62
+ ```sh
63
+ bin/logstash -e 'filter {awesome {}}'
64
+ ```
65
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
66
+
67
+ #### 2.2 Run in an installed Logstash
68
+
69
+ 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:
70
+
71
+ - Build your plugin gem
72
+ ```sh
73
+ gem build logstash-filter-awesome.gemspec
74
+ ```
75
+ - Install the plugin from the Logstash home
76
+ ```sh
77
+ bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
78
+ ```
79
+ - Start Logstash and proceed to test the plugin
80
+
81
+ ## Contributing
82
+
83
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
84
+
85
+ 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.
86
+
87
+ It is more important to the community that you are able to contribute.
88
+
89
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+ require "logstash/inputs/base"
3
+ require "logstash/namespace"
4
+ require "stud/interval"
5
+ require "socket" # for Socket.gethostname
6
+
7
+ # Generate a repeating message.
8
+ #
9
+ # This plugin is intented only as an example.
10
+
11
+ class LogStash::Inputs::Example < LogStash::Inputs::Base
12
+ config_name "example"
13
+
14
+ # If undefined, Logstash will complain, even if codec is unused.
15
+ default :codec, "plain"
16
+
17
+ # The message string to use in the event.
18
+ config :message, :validate => :string, :default => "Hello World!"
19
+
20
+ # Set how frequently messages should be sent.
21
+ #
22
+ # The default, `1`, means send a message every second.
23
+ config :interval, :validate => :number, :default => 1
24
+
25
+ public
26
+ def register
27
+ @host = Socket.gethostname
28
+ end # def register
29
+
30
+ def run(queue)
31
+ # we can abort the loop if stop? becomes true
32
+ while !stop?
33
+ event = LogStash::Event.new("message" => @message, "host" => @host)
34
+ decorate(event)
35
+ queue << event
36
+ # because the sleep interval can be big, when shutdown happens
37
+ # we want to be able to abort the sleep
38
+ # Stud.stoppable_sleep will frequently evaluate the given block
39
+ # and abort the sleep(@interval) if the return value is true
40
+ Stud.stoppable_sleep(@interval) { stop? }
41
+ end # loop
42
+ end # def run
43
+
44
+ def stop
45
+ # nothing to do in this case so it is not necessary to define stop
46
+ # examples of common "stop" tasks:
47
+ # * close sockets (unblocking blocking reads/accepts)
48
+ # * cleanup temporary files
49
+ # * terminate spawned threads
50
+ end
51
+ end # class LogStash::Inputs::Example
@@ -0,0 +1,21 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-input-thisisonlyatest'
3
+ s.version = '1.0.3'
4
+ s.licenses = ['Apache License (2.0)']
5
+ s.summary = "This example input streams a string at a definable interval."
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 = ["Elastic"]
8
+ s.email = 'info@elastic.co'
9
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10
+ s.require_paths = ["lib"]
11
+
12
+ # Files
13
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
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" => "input" }
19
+
20
+ s.add_runtime_dependency "ph-core-plugin-api", "~> 1.0"
21
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
3
+ require "logstash/inputs/example"
4
+
5
+ describe LogStash::Inputs::Example do
6
+
7
+ it_behaves_like "an interruptible input plugin" do
8
+ let(:config) { { "interval" => 100 } }
9
+ end
10
+
11
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-input-thisisonlyatest
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Elastic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ph-core-plugin-api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: This gem is a logstash plugin required to be installed on top of the
28
+ Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
29
+ a stand-alone program
30
+ email: info@elastic.co
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - CHANGELOG.md
36
+ - DEVELOPER.md
37
+ - Gemfile
38
+ - LICENSE
39
+ - NOTICE.TXT
40
+ - README.md
41
+ - lib/logstash/inputs/example.rb
42
+ - logstash-input-thisisonlyatest.gemspec
43
+ - spec/inputs/example_spec.rb
44
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
45
+ licenses:
46
+ - Apache License (2.0)
47
+ metadata:
48
+ logstash_plugin: 'true'
49
+ logstash_group: input
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.5.1
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: This example input streams a string at a definable interval.
70
+ test_files:
71
+ - spec/inputs/example_spec.rb