logstash-input-stdin 3.0.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 031a99fceb69486b762269f5640bce0ede4f7151
4
- data.tar.gz: 1a8b8e6c6176b3be99c167ad25562672679165f0
3
+ metadata.gz: 08ba14396769f613c936e597d53876ed93aa8893
4
+ data.tar.gz: 2010268257aafe849e05332b6303d735691f7f78
5
5
  SHA512:
6
- metadata.gz: ea31be3506bf6bc902045d7241e81427da1eb99c475d08de97ef9e49c8deacb104c61503848f90c788aa19576b7e05826d4de1d8a78f78f345aea6af368b2f25
7
- data.tar.gz: fc9435f5c8d6eb94f9a5e7bad8f222f045668edcd966aba85bf45abae588c828b763898d1a2e8eb5d856614930abadbf030ac0cc6d0be5a973417c33d79bc011
6
+ metadata.gz: 89991da3b7e223a673efbca242f117de01522a791e357e1a7ff8e6fd1e1073e94a75628adeed2589f62befeb434895e83964a12d9822c20e6f58583541f76df1
7
+ data.tar.gz: 277e76a57cc077ff58af69f7cfea56545f07aa7cc148f59efa29dd598f68acfed5af5516f704102068bee232415a15d0a7289338ff36fd1a6f4643f4e6fa63a3
@@ -1,13 +1,23 @@
1
+ ## 3.1.0
2
+ - Use interruptible stdin channel when possible, see https://github.com/logstash-plugins/logstash-input-stdin/pull/3
3
+
1
4
  ## 3.0.1
2
5
  - Republish all the gems under jruby.
6
+
3
7
  ## 3.0.0
4
8
  - Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
5
- # 2.0.4
6
- - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
7
- # 2.0.3
8
- - New dependency requirements for logstash-core for the 5.0 release
9
+
10
+ ## 2.1.0
11
+ - support interruptible stdin, see https://github.com/logstash-plugins/logstash-input-stdin/pull/3
12
+
13
+ ## 2.0.4
14
+ - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
15
+
16
+ ## 2.0.3
17
+ - New dependency requirements for logstash-core for the 5.0 release
18
+
9
19
  ## 2.0.0
10
- - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
20
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
11
21
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
12
22
  - Dependency on logstash-core update to 2.0
13
23
 
@@ -3,6 +3,7 @@ require "logstash/inputs/base"
3
3
  require "logstash/namespace"
4
4
  require "concurrent/atomics"
5
5
  require "socket" # for Socket.gethostname
6
+ require "jruby-stdin-channel"
6
7
 
7
8
  # Read events from standard input.
8
9
  #
@@ -13,33 +14,66 @@ class LogStash::Inputs::Stdin < LogStash::Inputs::Base
13
14
 
14
15
  default :codec, "line"
15
16
 
17
+ READ_SIZE = 16384
18
+
16
19
  def register
20
+ begin
21
+ @stdin = StdinChannel::Reader.new
22
+ self.class.module_exec { alias_method :stdin_read, :channel_read }
23
+ self.class.module_exec { alias_method :stop, :channel_stop}
24
+ rescue => e
25
+ @logger.debug("fallback to reading from regular $stdin", :exception => e)
26
+ self.class.module_exec { alias_method :stdin_read, :default_read }
27
+ self.class.module_exec { alias_method :stop, :default_stop }
28
+ end
29
+
17
30
  @host = Socket.gethostname
18
31
  fix_streaming_codecs
19
32
  end
20
33
 
21
34
  def run(queue)
22
35
  while !stop?
23
- begin
24
- # Based on some testing, there is no way to interrupt an IO.sysread nor
25
- # IO.select call in JRuby. Bummer :(
26
- data = $stdin.sysread(16384)
36
+ if data = stdin_read
27
37
  @codec.decode(data) do |event|
28
38
  decorate(event)
29
39
  event.set("host", @host) if !event.include?("host")
30
40
  queue << event
31
41
  end
32
- rescue IOError, EOFError # stdin closed
33
- break
34
- rescue => e
35
- # ignore any exception in the shutdown process
36
- break if stop?
37
- raise(e)
38
42
  end
39
43
  end
40
44
  end
41
45
 
42
- def stop
46
+ private
47
+
48
+ def default_stop
43
49
  $stdin.close rescue nil
44
50
  end
51
+
52
+ def channel_stop
53
+ @stdin.close rescue nil
54
+ end
55
+
56
+ def default_read
57
+ begin
58
+ return $stdin.sysread(READ_SIZE)
59
+ rescue IOError, EOFError
60
+ do_stop
61
+ rescue => e
62
+ # ignore any exception in the shutdown process
63
+ raise(e) unless stop?
64
+ end
65
+ nil
66
+ end
67
+
68
+ def channel_read
69
+ begin
70
+ return @stdin.read(READ_SIZE)
71
+ rescue IOError, EOFError, StdinChannel::ClosedChannelError
72
+ do_stop
73
+ rescue => e
74
+ # ignore any exception in the shutdown process
75
+ raise(e) unless stop?
76
+ end
77
+ nil
78
+ end
45
79
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-stdin'
4
- s.version = '3.0.1'
4
+ s.version = '3.1.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Read events from standard input"
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/logstash-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 = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*', 'spec/**/*', '*.gemspec', '*.md', 'CONTRIBUTORS', 'Gemfile', 'LICENSE', 'NOTICE.TXT', 'CHANGELOG.md', 'README.md']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -21,12 +21,12 @@ Gem::Specification.new do |s|
21
21
 
22
22
  # Gem dependencies
23
23
  s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
24
- s.add_runtime_dependency 'logstash-codec-line'
25
- s.add_runtime_dependency 'concurrent-ruby'
24
+ s.add_runtime_dependency "logstash-codec-line"
25
+ s.add_runtime_dependency "concurrent-ruby"
26
+ s.add_runtime_dependency "jruby-stdin-channel"
26
27
 
27
- s.add_development_dependency 'logstash-codec-plain'
28
- s.add_development_dependency 'logstash-codec-json'
29
- s.add_development_dependency 'logstash-codec-json_lines'
30
- s.add_development_dependency 'logstash-devutils'
28
+ s.add_development_dependency "logstash-codec-plain"
29
+ s.add_development_dependency "logstash-codec-json"
30
+ s.add_development_dependency "logstash-codec-json_lines"
31
+ s.add_development_dependency "logstash-devutils"
31
32
  end
32
-
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-stdin
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-05-25 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
18
  version: '2.0'
19
19
  name: logstash-core-plugin-api
@@ -21,13 +21,13 @@ dependencies:
21
21
  type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  name: logstash-codec-line
@@ -35,13 +35,13 @@ dependencies:
35
35
  type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  name: concurrent-ruby
@@ -49,13 +49,27 @@ dependencies:
49
49
  type: :runtime
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: jruby-stdin-channel
62
+ prerelease: false
63
+ type: :runtime
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
59
73
  - !ruby/object:Gem::Version
60
74
  version: '0'
61
75
  name: logstash-codec-plain
@@ -63,13 +77,13 @@ dependencies:
63
77
  type: :development
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - '>='
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  requirement: !ruby/object:Gem::Requirement
71
85
  requirements:
72
- - - ">="
86
+ - - '>='
73
87
  - !ruby/object:Gem::Version
74
88
  version: '0'
75
89
  name: logstash-codec-json
@@ -77,13 +91,13 @@ dependencies:
77
91
  type: :development
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - '>='
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  requirement: !ruby/object:Gem::Requirement
85
99
  requirements:
86
- - - ">="
100
+ - - '>='
87
101
  - !ruby/object:Gem::Version
88
102
  version: '0'
89
103
  name: logstash-codec-json_lines
@@ -91,13 +105,13 @@ dependencies:
91
105
  type: :development
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ">="
108
+ - - '>='
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  requirement: !ruby/object:Gem::Requirement
99
113
  requirements:
100
- - - ">="
114
+ - - '>='
101
115
  - !ruby/object:Gem::Version
102
116
  version: '0'
103
117
  name: logstash-devutils
@@ -105,7 +119,7 @@ dependencies:
105
119
  type: :development
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ">="
122
+ - - '>='
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  description: This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program
@@ -114,18 +128,12 @@ executables: []
114
128
  extensions: []
115
129
  extra_rdoc_files: []
116
130
  files:
117
- - ".github/CONTRIBUTING.md"
118
- - ".github/ISSUE_TEMPLATE.md"
119
- - ".github/PULL_REQUEST_TEMPLATE.md"
120
- - ".gitignore"
121
- - ".travis.yml"
122
131
  - CHANGELOG.md
123
132
  - CONTRIBUTORS
124
133
  - Gemfile
125
134
  - LICENSE
126
135
  - NOTICE.TXT
127
136
  - README.md
128
- - Rakefile
129
137
  - lib/logstash/inputs/stdin.rb
130
138
  - logstash-input-stdin.gemspec
131
139
  - spec/inputs/stdin_spec.rb
@@ -141,17 +149,17 @@ require_paths:
141
149
  - lib
142
150
  required_ruby_version: !ruby/object:Gem::Requirement
143
151
  requirements:
144
- - - ">="
152
+ - - '>='
145
153
  - !ruby/object:Gem::Version
146
154
  version: '0'
147
155
  required_rubygems_version: !ruby/object:Gem::Requirement
148
156
  requirements:
149
- - - ">="
157
+ - - '>='
150
158
  - !ruby/object:Gem::Version
151
159
  version: '0'
152
160
  requirements: []
153
161
  rubyforge_project:
154
- rubygems_version: 2.4.8
162
+ rubygems_version: 2.4.5
155
163
  signing_key:
156
164
  specification_version: 4
157
165
  summary: Read events from standard input
@@ -1,65 +0,0 @@
1
- # Contributing to Logstash
2
-
3
- All contributions are welcome: ideas, patches, documentation, bug reports,
4
- complaints, etc!
5
-
6
- Programming is not a required skill, and there are many ways to help out!
7
- It is more important to us that you are able to contribute.
8
-
9
- That said, some basic guidelines, which you are free to ignore :)
10
-
11
- ## Want to learn?
12
-
13
- Want to lurk about and see what others are doing with Logstash?
14
-
15
- * The irc channel (#logstash on irc.freenode.org) is a good place for this
16
- * The [forum](https://discuss.elastic.co/c/logstash) is also
17
- great for learning from others.
18
-
19
- ## Got Questions?
20
-
21
- Have a problem you want Logstash to solve for you?
22
-
23
- * You can ask a question in the [forum](https://discuss.elastic.co/c/logstash)
24
- * Alternately, you are welcome to join the IRC channel #logstash on
25
- irc.freenode.org and ask for help there!
26
-
27
- ## Have an Idea or Feature Request?
28
-
29
- * File a ticket on [GitHub](https://github.com/elastic/logstash/issues). Please remember that GitHub is used only for issues and feature requests. If you have a general question, the [forum](https://discuss.elastic.co/c/logstash) or IRC would be the best place to ask.
30
-
31
- ## Something Not Working? Found a Bug?
32
-
33
- If you think you found a bug, it probably is a bug.
34
-
35
- * If it is a general Logstash or a pipeline issue, file it in [Logstash GitHub](https://github.com/elasticsearch/logstash/issues)
36
- * If it is specific to a plugin, please file it in the respective repository under [logstash-plugins](https://github.com/logstash-plugins)
37
- * or ask the [forum](https://discuss.elastic.co/c/logstash).
38
-
39
- # Contributing Documentation and Code Changes
40
-
41
- If you have a bugfix or new feature that you would like to contribute to
42
- logstash, and you think it will take more than a few minutes to produce the fix
43
- (ie; write code), it is worth discussing the change with the Logstash users and developers first! You can reach us via [GitHub](https://github.com/elastic/logstash/issues), the [forum](https://discuss.elastic.co/c/logstash), or via IRC (#logstash on freenode irc)
44
- Please note that Pull Requests without tests will not be merged. If you would like to contribute but do not have experience with writing tests, please ping us on IRC/forum or create a PR and ask our help.
45
-
46
- ## Contributing to plugins
47
-
48
- Check our [documentation](https://www.elastic.co/guide/en/logstash/current/contributing-to-logstash.html) on how to contribute to plugins or write your own! It is super easy!
49
-
50
- ## Contribution Steps
51
-
52
- 1. Test your changes! [Run](https://github.com/elastic/logstash#testing) the test suite
53
- 2. Please make sure you have signed our [Contributor License
54
- Agreement](https://www.elastic.co/contributor-agreement/). We are not
55
- asking you to assign copyright to us, but to give us the right to distribute
56
- your code without restriction. We ask this of all contributors in order to
57
- assure our users of the origin and continuing existence of the code. You
58
- only need to sign the CLA once.
59
- 3. Send a pull request! Push your changes to your fork of the repository and
60
- [submit a pull
61
- request](https://help.github.com/articles/using-pull-requests). In the pull
62
- request, describe what your changes do and mention any bugs/issues related
63
- to the pull request.
64
-
65
-
@@ -1,9 +0,0 @@
1
- Please post all product and debugging questions on our [forum](https://discuss.elastic.co/c/logstash). Your questions will reach our wider community members there, and if we confirm that there is a bug, then we can open a new issue here.
2
-
3
- For all general issues, please provide the following details for fast resolution:
4
-
5
- - Version:
6
- - Operating System:
7
- - Config File (if you have sensitive info, please remove it):
8
- - Sample Data:
9
- - Steps to Reproduce:
@@ -1 +0,0 @@
1
- Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
@@ -1,11 +0,0 @@
1
- ---
2
- sudo: false
3
- jdk:
4
- - oraclejdk8
5
- language: ruby
6
- cache: bundler
7
- rvm:
8
- - jruby-1.7.25
9
- before_install: []
10
- script:
11
- - bundle exec rspec spec
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"