logstash-output-exec 2.0.5 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fa722dbb26dda585a5bad9fb5c8730c1003351e
4
- data.tar.gz: cc16d47ab25586b1ea7372e02045043c69d02731
3
+ metadata.gz: 2bdeec96c14614c24d71fd8f1a4c1650292e1ac1
4
+ data.tar.gz: d11697e80a52dff7fa5470cd682812e015eb18e8
5
5
  SHA512:
6
- metadata.gz: 6b06b2ce9884f534baaa564f3e0ff13e5c1e4765d66ccd98627ee8844a66d8c86d90457e1ff7470faa2aa7b8bf2bc5ad10e6914910a09ac877cc5a204ab92ad6
7
- data.tar.gz: 92aac26fab00849f14046955ee2ee02ce6403e324469e3b9609cda2d2acca81bfadb4d4f25fbf57921276567fe40eabb08aca98508b91c13be81cc04d8d57624
6
+ metadata.gz: 418783b92cde5628872a56963cc47cbb238ba456733db1fa29d1e5ccccbbcf4730d4256fd5b76538f914be99431a4ac89f6e398bd4d27d09a5d21335604a01b1
7
+ data.tar.gz: 31be010132dfe5a3d9d80a62cde32a8c18f149d4e630990e1a5ec3f3c2c326910c010c1a0d7c5cf624957efd9f70a9a2abe6956416229691ec03dfe4a4ffc894
data/CHANGELOG.md CHANGED
@@ -1,15 +1,9 @@
1
- ## 2.0.5
2
- - Replace `Kernel.system` with `Open3.open3` and fixes `ThreadDeath` issues
3
- - Will now log stdout and stderr of the command when running logstash in debug mode, the response is streamed to the log.
4
- - Added a `quiet` option to not print the result of the command to stdout, this option is on by default for backward compatibility
5
- - Added tests
6
-
7
- ## 2.0.4
1
+ ## 3.0.0
2
+ - 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
3
+ # 2.0.4
8
4
  - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
9
-
10
- ## 2.0.3
5
+ # 2.0.3
11
6
  - New dependency requirements for logstash-core for the 5.0 release
12
-
13
7
  ## 2.0.0
14
8
  - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
15
9
  instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+
3
+ # Specify your gem's dependencies in logstash-mass_effect.gemspec
4
+ gemspec
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/namespace"
3
3
  require "logstash/outputs/base"
4
- require "open3"
5
4
 
6
5
  # The exec output will run a command for each event received. Ruby's
7
6
  # `system()` function will be used, i.e. the command string will
@@ -35,33 +34,16 @@ class LogStash::Outputs::Exec < LogStash::Outputs::Base
35
34
  # dynamic strings.
36
35
  config :command, :validate => :string, :required => true
37
36
 
38
- # display the result of the command to the terminal
39
- config :quiet, :validate => :boolean, :default => false
40
-
41
37
  public
42
38
  def register
43
39
  @logger.debug("exec output registered", :config => @config)
44
- end
40
+ end # def register
45
41
 
46
42
  public
47
43
  def receive(event)
48
- cmd = event.sprintf(@command)
49
- @logger.debug("running exec command", :command => cmd)
50
-
51
- Open3.popen3(cmd) do |stdin, stdout, stderr|
52
- if @logger.debug?
53
- @logger.pipe(stdout => :debug, stderr => :debug)
54
- else
55
- # This is for backward compatibility,
56
- # the previous implementation was using `Kernel#system' and the default behavior
57
- # of this method is to output the result to the terminal.
58
- @logger.terminal(stdout.read.chomp) unless quiet?
59
- end
60
- end
61
- end
44
+
45
+ @logger.debug("running exec command", :command => event.sprintf(@command))
46
+ system(event.sprintf(@command))
47
+ end # def receive
62
48
 
63
- private
64
- def quiet?
65
- @quiet
66
- end
67
49
  end
@@ -1,6 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
+
2
3
  s.name = 'logstash-output-exec'
3
- s.version = '2.0.5'
4
+ s.version = '3.0.0'
4
5
  s.licenses = ['Apache License (2.0)']
5
6
  s.summary = "This output will run a command for any matching event."
6
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"
@@ -19,9 +20,8 @@ Gem::Specification.new do |s|
19
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
20
21
 
21
22
  # Gem dependencies
22
- s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0"
23
+ s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
23
24
 
24
25
  s.add_development_dependency 'logstash-devutils'
25
- s.add_development_dependency "logstash-codec-plain"
26
26
  end
27
27
 
@@ -1,48 +1 @@
1
- # encoding: utf-8
2
- require "logstash/outputs/exec"
3
- require "logstash/event"
4
1
  require "logstash/devutils/rspec/spec_helper"
5
- require "tempfile"
6
-
7
- describe LogStash::Outputs::Exec do
8
- let(:event) { LogStash::Event.new({ "params" => "1234" }) }
9
- let(:output) { "1" }
10
- let(:command) { "echo #{output}" }
11
-
12
- let(:config) do
13
- { "command" => command }
14
- end
15
-
16
- let(:error_message) { "Oulala" }
17
- let(:stderr) { Tempfile.new(error_message) }
18
- let(:stdout) { Tempfile.new(output) }
19
- let(:stdin) { Tempfile.new("") }
20
-
21
- subject { described_class.new(config) }
22
-
23
- it "receive a command and execute it" do
24
- expect(Open3).to receive(:popen3).with(command)
25
- subject.receive(event)
26
- end
27
-
28
- context "when debugging" do
29
- before :each do
30
- allow(subject.logger).to receive(:debug?).and_return(true)
31
- expect(Open3).to receive(:popen3).with(command).and_yield(stdin, stdout, stderr)
32
- end
33
-
34
- it "register the stdout and stderr to the logger" do
35
- expect(subject.logger).to receive(:pipe).with(stdout => :debug, stderr => :debug)
36
- subject.receive(event)
37
- end
38
- end
39
-
40
- context "When debugging is off" do
41
- context "when quiet is off" do
42
- it "write output to the terminal" do
43
- expect(subject.logger).to receive(:terminal).with(output)
44
- subject.receive(event)
45
- end
46
- end
47
- end
48
- end
metadata CHANGED
@@ -1,58 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: logstash-core-plugin-api
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
- version: '1.0'
19
- name: logstash-core-plugin-api
20
- prerelease: false
19
+ version: '2.0'
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
28
  name: logstash-devutils
34
- prerelease: false
35
- type: :development
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
29
  requirement: !ruby/object:Gem::Requirement
43
30
  requirements:
44
31
  - - ">="
45
32
  - !ruby/object:Gem::Version
46
33
  version: '0'
47
- name: logstash-codec-plain
48
- prerelease: false
49
34
  type: :development
35
+ prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
- 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
41
+ description: This gem is a Logstash plugin required to be installed on top of the
42
+ Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
43
+ gem is not a stand-alone program
56
44
  email: info@elastic.co
57
45
  executables: []
58
46
  extensions: []
@@ -73,7 +61,7 @@ licenses:
73
61
  metadata:
74
62
  logstash_plugin: 'true'
75
63
  logstash_group: output
76
- post_install_message:
64
+ post_install_message:
77
65
  rdoc_options: []
78
66
  require_paths:
79
67
  - lib
@@ -88,9 +76,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
76
  - !ruby/object:Gem::Version
89
77
  version: '0'
90
78
  requirements: []
91
- rubyforge_project:
92
- rubygems_version: 2.4.8
93
- signing_key:
79
+ rubyforge_project:
80
+ rubygems_version: 2.5.1
81
+ signing_key:
94
82
  specification_version: 4
95
83
  summary: This output will run a command for any matching event.
96
84
  test_files: