logstash-core 5.2.0-java → 5.2.1-java

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: 50660404c5ec13b21a5dccc7fd62b0d282dea262
4
- data.tar.gz: 5b5b44f759032fda3022a8d08f982cf35ef5179a
3
+ metadata.gz: c4df5ad1b48f429f25bc3f16f97973b531b3c5d6
4
+ data.tar.gz: 1a59f8132f4156de4cb846d05a417e2d44ba6164
5
5
  SHA512:
6
- metadata.gz: 134ef54d0f7ef058c201420d997e702775bf4520e747a6c40ec76a6593597192a6448a537bad0e1df236214d636b469c6d95faa4894492cb05c23c826b0ce4e9
7
- data.tar.gz: fa146b9c7ccd8891ed64dc892026313ff6356d87511613e23a270b8a30fa33a664a87d39b586b51b3e94961a3a18dd3640087746bdf965a5a603ff3bfd514b21
6
+ metadata.gz: 1487f73f2dba8861338bf93548c9b5dfac360fc2ecc26c6a776cffa0cec848426e1422dc9ae1178c7cdb2759fcf62be3d8f690419cbf9bce0a8b04f75ad06370
7
+ data.tar.gz: 24a249aca51af3100d5c533f5a0491480718ad145b806f148ea36e366e05a35378366aa2819d98bb5c6f2a7dda0f0446103a04d33a27d6ac47d4296741ab2c90
@@ -5,4 +5,4 @@
5
5
  # Note to authors: this should not include dashes because 'gem' barfs if
6
6
  # you include a dash in the version string.
7
7
 
8
- LOGSTASH_CORE_VERSION = "5.2.0"
8
+ LOGSTASH_CORE_VERSION = "5.2.1"
@@ -19,18 +19,20 @@ class LogStash::Plugin
19
19
  # for a specific plugin.
20
20
  config :enable_metric, :validate => :boolean, :default => true
21
21
 
22
- # Add a unique `ID` to the plugin instance, this `ID` is used for tracking
23
- # information for a specific configuration of the plugin.
22
+ # Add a unique `ID` to the plugin configuration. If no ID is specified, Logstash will generate one.
23
+ # It is strongly recommended to set this ID in your configuration. This is particulary useful
24
+ # when you have two or more plugins of the same type, for example, if you have 2 grok filters.
25
+ # Adding a named ID in this case will help in monitoring Logstash when using the monitoring APIs.
24
26
  #
25
- # ```
27
+ # [source,ruby]
28
+ # ---------------------------------------------------------------------------------------------------
26
29
  # output {
27
30
  # stdout {
28
- # id => "ABC"
31
+ # id => "my_plugin_id"
29
32
  # }
30
33
  # }
31
- # ```
34
+ # ---------------------------------------------------------------------------------------------------
32
35
  #
33
- # If you don't explicitely set this variable Logstash will generate a unique name.
34
36
  config :id, :validate => :string
35
37
 
36
38
  def hash
@@ -489,6 +489,32 @@ module LogStash
489
489
  Util::TimeValue.from_value(value).to_nanos
490
490
  end
491
491
  end
492
+
493
+ class ArrayCoercible < Coercible
494
+ def initialize(name, klass, default, strict=true, &validator_proc)
495
+ @element_class = klass
496
+ super(name, ::Array, default, strict, &validator_proc)
497
+ end
498
+
499
+ def coerce(value)
500
+ Array(value)
501
+ end
502
+
503
+ protected
504
+ def validate(input)
505
+ if !input.is_a?(@klass)
506
+ raise ArgumentError.new("Setting \"#{@name}\" must be a #{@klass}. Received: #{input} (#{input.class})")
507
+ end
508
+
509
+ unless input.all? {|el| el.kind_of?(@element_class) }
510
+ raise ArgumentError.new("Values of setting \"#{@name}\" must be #{@element_class}. Received: #{input.map(&:class)}")
511
+ end
512
+
513
+ if @validator_proc && !@validator_proc.call(input)
514
+ raise ArgumentError.new("Failed to validate setting \"#{@name}\" with value: #{input}")
515
+ end
516
+ end
517
+ end
492
518
  end
493
519
 
494
520
 
@@ -44,7 +44,7 @@ module LogStash
44
44
  @reports << pipeline_report_snapshot
45
45
  @reports.delete_at(0) if @reports.size > @report_every # expire old report
46
46
  if cycle_number == (@report_every - 1) # it's report time!
47
- logger.warn(@reports.last)
47
+ logger.warn(@reports.last.to_s)
48
48
 
49
49
  if shutdown_stalled?
50
50
  logger.error("The shutdown process appears to be stalled due to busy or blocked plugins. Check the logs for more information.") if stalled_count == 0
@@ -47,5 +47,10 @@ class LogStash::Util::SafeURI
47
47
  def ==(other)
48
48
  other.is_a?(::LogStash::Util::SafeURI) ? @uri == other.uri : false
49
49
  end
50
+
51
+ def clone
52
+ cloned_uri = uri.clone
53
+ self.class.new(cloned_uri)
54
+ end
50
55
  end
51
56
 
@@ -11,4 +11,4 @@
11
11
  # eventually this file should be in the root logstash lib fir and dependencies in logstash-core should be
12
12
  # fixed.
13
13
 
14
- LOGSTASH_VERSION = "5.2.0"
14
+ LOGSTASH_VERSION = "5.2.1"
@@ -0,0 +1,46 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+ require "logstash/settings"
4
+
5
+ describe LogStash::Setting::ArrayCoercible do
6
+ subject { described_class.new("option", element_class, value) }
7
+ let(:value) { [ ] }
8
+ let(:element_class) { Object }
9
+
10
+ context "when given a non array value" do
11
+ let(:value) { "test" }
12
+ describe "the value" do
13
+ it "is converted to an array with that single element" do
14
+ expect(subject.value).to eq(["test"])
15
+ end
16
+ end
17
+ end
18
+
19
+ context "when given an array value" do
20
+ let(:value) { ["test"] }
21
+ describe "the value" do
22
+ it "is not modified" do
23
+ expect(subject.value).to eq(value)
24
+ end
25
+ end
26
+ end
27
+
28
+ describe "initialization" do
29
+ subject { described_class }
30
+ let(:element_class) { Fixnum }
31
+ context "when given values of incorrect element class" do
32
+ let(:value) { "test" }
33
+
34
+ it "will raise an exception" do
35
+ expect { described_class.new("option", element_class, value) }.to raise_error(ArgumentError)
36
+ end
37
+ end
38
+ context "when given values of correct element class" do
39
+ let(:value) { 1 }
40
+
41
+ it "will not raise an exception" do
42
+ expect { described_class.new("option", element_class, value) }.not_to raise_error
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+ require "logstash/util/safe_uri"
3
+ require "spec_helper"
4
+
5
+ module LogStash module Util
6
+ describe SafeURI do
7
+ describe "#clone" do
8
+ subject { LogStash::Util::SafeURI.new("http://localhost:9200/uri?q=s") }
9
+ it "allows modifying uri parameters" do
10
+ cloned_safe_uri = subject.clone
11
+ cloned_safe_uri.path = "/cloned"
12
+ cloned_safe_uri.query = "a=b"
13
+ expect(subject.path).to eq("/uri")
14
+ expect(subject.query).to eq("q=s")
15
+ expect(cloned_safe_uri.path).to eq("/cloned")
16
+ expect(cloned_safe_uri.query).to eq("a=b")
17
+ end
18
+ end
19
+ end
20
+ end end
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.2.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
11
+ date: 2017-02-09 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
- version: 5.2.0
18
+ version: 5.2.1
19
19
  name: logstash-core-event-java
20
20
  prerelease: false
21
21
  type: :runtime
@@ -23,13 +23,13 @@ dependencies:
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.0
26
+ version: 5.2.1
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
- version: 5.2.0
32
+ version: 5.2.1
33
33
  name: logstash-core-queue-jruby
34
34
  prerelease: false
35
35
  type: :runtime
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 5.2.0
40
+ version: 5.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
@@ -484,6 +484,7 @@ files:
484
484
  - spec/logstash/plugins/registry_spec.rb
485
485
  - spec/logstash/runner_spec.rb
486
486
  - spec/logstash/setting_spec.rb
487
+ - spec/logstash/settings/array_coercible_spec.rb
487
488
  - spec/logstash/settings/bytes_spec.rb
488
489
  - spec/logstash/settings/integer_spec.rb
489
490
  - spec/logstash/settings/numeric_spec.rb
@@ -499,6 +500,7 @@ files:
499
500
  - spec/logstash/util/duration_formatter_spec.rb
500
501
  - spec/logstash/util/java_version_spec.rb
501
502
  - spec/logstash/util/plugin_version_spec.rb
503
+ - spec/logstash/util/safe_uri_spec.rb
502
504
  - spec/logstash/util/time_value_spec.rb
503
505
  - spec/logstash/util/unicode_trimmer_spec.rb
504
506
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb
@@ -588,6 +590,7 @@ test_files:
588
590
  - spec/logstash/plugins/registry_spec.rb
589
591
  - spec/logstash/runner_spec.rb
590
592
  - spec/logstash/setting_spec.rb
593
+ - spec/logstash/settings/array_coercible_spec.rb
591
594
  - spec/logstash/settings/bytes_spec.rb
592
595
  - spec/logstash/settings/integer_spec.rb
593
596
  - spec/logstash/settings/numeric_spec.rb
@@ -603,6 +606,7 @@ test_files:
603
606
  - spec/logstash/util/duration_formatter_spec.rb
604
607
  - spec/logstash/util/java_version_spec.rb
605
608
  - spec/logstash/util/plugin_version_spec.rb
609
+ - spec/logstash/util/safe_uri_spec.rb
606
610
  - spec/logstash/util/time_value_spec.rb
607
611
  - spec/logstash/util/unicode_trimmer_spec.rb
608
612
  - spec/logstash/util/wrapped_synchronous_queue_spec.rb