logstash-core 5.6.5-java → 5.6.6-java

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: 7d30cf0d0e9fd2059e3e39c1b1d66b69cd3ab027
4
- data.tar.gz: 0588a9533169bcef1457548abcd613c6b16997a9
3
+ metadata.gz: ac3afa459e4fb90932a6222ae0cdb6e1c511c98a
4
+ data.tar.gz: 781766e9a85797a32c5dd2277a51de3f5b3b11d6
5
5
  SHA512:
6
- metadata.gz: f94f9f48e66e099b55b00318662da76f5adda111ccb581954a7cbd3f94454422129973602c773645daa1e0996bd2edde1256ceee5ec4b5ddf2f922290864958b
7
- data.tar.gz: f4d9d880baa2832e7caa7ee5e621419d221e96e913b51215cd0ae521bf3cf97e37540eb136f7f1da280e6b1eb67f36d69ee95cb04bed76f933b2030c5d2d8dcf
6
+ metadata.gz: 8059e6050e85dcb936a0d66130541be7c1e5942f0f5893089098a93be0062b9d73f4f3268607fbbc8548c3520d8bb363a6aefc6dca72054eebb99f4de11475d0
7
+ data.tar.gz: de2b67e382baacbdc8fcd354c27763cf3b01dc8793327f29e0c3c4f70d0d1d224e2eba95057123ca79fb0137a2d0a3ff0d12856e0bbee637f2e0adf45d586887
@@ -14,13 +14,13 @@ rescue LoadError
14
14
  end
15
15
 
16
16
  if defined? Jars
17
- require_jar( 'org.apache.logging.log4j', 'log4j-core', '2.6.2' )
18
- require_jar( 'com.fasterxml.jackson.core', 'jackson-databind', '2.9.1' )
19
- require_jar( 'org.apache.logging.log4j', 'log4j-api', '2.6.2' )
20
- require_jar( 'org.slf4j', 'slf4j-api', '1.7.21' )
21
- require_jar( 'com.fasterxml.jackson.core', 'jackson-annotations', '2.9.1' )
22
- require_jar( 'org.apache.logging.log4j', 'log4j-slf4j-impl', '2.6.2' )
23
- require_jar( 'com.fasterxml.jackson.module', 'jackson-module-afterburner', '2.9.1' )
24
- require_jar( 'com.fasterxml.jackson.dataformat', 'jackson-dataformat-cbor', '2.9.1' )
25
- require_jar( 'com.fasterxml.jackson.core', 'jackson-core', '2.9.1' )
17
+ require_jar 'org.apache.logging.log4j', 'log4j-core', '2.6.2'
18
+ require_jar 'com.fasterxml.jackson.core', 'jackson-databind', '2.9.1'
19
+ require_jar 'org.apache.logging.log4j', 'log4j-api', '2.6.2'
20
+ require_jar 'org.slf4j', 'slf4j-api', '1.7.21'
21
+ require_jar 'com.fasterxml.jackson.core', 'jackson-annotations', '2.9.1'
22
+ require_jar 'org.apache.logging.log4j', 'log4j-slf4j-impl', '2.6.2'
23
+ require_jar 'com.fasterxml.jackson.module', 'jackson-module-afterburner', '2.9.1'
24
+ require_jar 'com.fasterxml.jackson.dataformat', 'jackson-dataformat-cbor', '2.9.1'
25
+ require_jar 'com.fasterxml.jackson.core', 'jackson-core', '2.9.1'
26
26
  end
@@ -60,30 +60,6 @@ module LogStash::Config::Mixin
60
60
  # store the plugin type, turns LogStash::Inputs::Base into 'input'
61
61
  @plugin_type = self.class.ancestors.find { |a| a.name =~ /::Base$/ }.config_name
62
62
 
63
- # warn about deprecated variable use
64
- params.each do |name, value|
65
- opts = self.class.get_config[name]
66
- if opts && opts[:deprecated]
67
- extra = opts[:deprecated].is_a?(String) ? opts[:deprecated] : ""
68
- extra.gsub!("%PLUGIN%", self.class.config_name)
69
- self.logger.warn("You are using a deprecated config setting " +
70
- "#{name.inspect} set in #{self.class.config_name}. " +
71
- "Deprecated settings will continue to work, " +
72
- "but are scheduled for removal from logstash " +
73
- "in the future. #{extra} If you have any questions " +
74
- "about this, please visit the #logstash channel " +
75
- "on freenode irc.", :name => name, :plugin => self)
76
-
77
- end
78
- if opts && opts[:obsolete]
79
- extra = opts[:obsolete].is_a?(String) ? opts[:obsolete] : ""
80
- extra.gsub!("%PLUGIN%", self.class.config_name)
81
- raise LogStash::ConfigurationError,
82
- I18n.t("logstash.runner.configuration.obsolete", :name => name,
83
- :plugin => self.class.config_name, :extra => extra)
84
- end
85
- end
86
-
87
63
  # Set defaults from 'config :foo, :default => somevalue'
88
64
  self.class.get_config.each do |name, opts|
89
65
  next if params.include?(name.to_s)
@@ -109,17 +85,46 @@ module LogStash::Config::Mixin
109
85
  params[name.to_s] = deep_replace(value)
110
86
  end
111
87
 
112
-
113
88
  if !self.class.validate(params)
114
89
  raise LogStash::ConfigurationError,
115
90
  I18n.t("logstash.runner.configuration.invalid_plugin_settings")
116
91
  end
117
92
 
93
+ # now that we know the parameters are valid, we can obfuscate the original copy
94
+ # of the parameters before storing them as an instance variable
95
+ self.class.secure_params!(original_params)
96
+ @original_params = original_params
97
+
98
+ # warn about deprecated variable use
99
+ original_params.each do |name, value|
100
+ opts = self.class.get_config[name]
101
+ if opts && opts[:deprecated]
102
+ extra = opts[:deprecated].is_a?(String) ? opts[:deprecated] : ""
103
+ extra.gsub!("%PLUGIN%", self.class.config_name)
104
+ self.logger.warn("You are using a deprecated config setting " +
105
+ "#{name.inspect} set in #{self.class.config_name}. " +
106
+ "Deprecated settings will continue to work, " +
107
+ "but are scheduled for removal from logstash " +
108
+ "in the future. #{extra} If you have any questions " +
109
+ "about this, please visit the #logstash channel " +
110
+ "on freenode irc.", :name => name, :plugin => self)
111
+
112
+ end
113
+
114
+ if opts && opts[:obsolete]
115
+ extra = opts[:obsolete].is_a?(String) ? opts[:obsolete] : ""
116
+ extra.gsub!("%PLUGIN%", self.class.config_name)
117
+ raise LogStash::ConfigurationError,
118
+ I18n.t("logstash.runner.configuration.obsolete", :name => name,
119
+ :plugin => self.class.config_name, :extra => extra)
120
+ end
121
+ end
122
+
118
123
  # We remove any config options marked as obsolete,
119
124
  # no code should be associated to them and their values should not bleed
120
125
  # to the plugin context.
121
126
  #
122
- # This need to be done after fetching the options from the parents classed
127
+ # This need to be done after fetching the options from the parents class
123
128
  params.reject! do |name, value|
124
129
  opts = self.class.get_config[name]
125
130
  opts.include?(:obsolete)
@@ -134,11 +139,6 @@ module LogStash::Config::Mixin
134
139
  instance_variable_set("@#{key}", value)
135
140
  end
136
141
 
137
- # now that we know the parameters are valid, we can obfuscate the original copy
138
- # of the parameters before storing them as an instance variable
139
- self.class.secure_params!(original_params)
140
- @original_params = original_params
141
-
142
142
  @config = params
143
143
  end # def config_init
144
144
 
@@ -0,0 +1,131 @@
1
+ # encoding: utf-8
2
+ Thread.abort_on_exception = true
3
+ Encoding.default_external = Encoding::UTF_8
4
+ $DEBUGLIST = (ENV["DEBUG"] || "").split(",")
5
+
6
+ require "clamp"
7
+ require "logstash/namespace"
8
+ require "rubygems"
9
+ require "jars/gemspec_artifacts"
10
+
11
+ class LogStash::DependencyReport < Clamp::Command
12
+ option [ "--csv" ], "OUTPUT_PATH", "The path to write the dependency report in csv format.",
13
+ :required => true, :attribute_name => :output_path
14
+
15
+ def execute
16
+ require "csv"
17
+ CSV.open(output_path, "wb", :headers => [ "name", "version", "url", "license" ], :write_headers => true) do |csv|
18
+ puts "Finding gem dependencies"
19
+ gems.each { |d| csv << d }
20
+ puts "Finding java/jar dependencies"
21
+ jars.each { |d| csv << d }
22
+ end
23
+
24
+ # Copy in COPYING.csv which is a best-effort, hand-maintained file of dependency license information.
25
+ File.open(output_path, "a+") do |file|
26
+ extra = File.join(File.dirname(__FILE__), "..", "..", "..", "COPYING.csv")
27
+ file.write(IO.read(extra))
28
+ end
29
+ nil
30
+ end
31
+
32
+ def gems
33
+ # @mgreau requested `logstash-*` dependencies be removed from this list:
34
+ # https://github.com/elastic/logstash/pull/8837#issuecomment-351859433
35
+ Gem::Specification.reject { |g| g.name =~ /^logstash-/ }.collect do |gem|
36
+ licenses = ("UNKNOWN" if gem.licenses.empty?) || (gem.licenses.map { |l| SPDX.map(l) }.join("|") if !gem.licenses.empty?)
37
+ [gem.name, gem.version.to_s, gem.homepage, licenses]
38
+ end
39
+ end
40
+
41
+ def jars
42
+ jars = []
43
+ # For any gems with jar dependencies,
44
+ # Look at META-INF/MANIFEST.MF for any jars in each gem
45
+ # Note any important details.
46
+ Gem::Specification.select { |g| g.requirements && g.requirements.any? { |r| r =~ /^jar / } }.collect do |gem|
47
+
48
+ # Where is the gem installed
49
+ root = gem.full_gem_path
50
+
51
+ Dir.glob(File.join(root, "**", "*.jar")).collect do |path|
52
+ jar = java.util.jar.JarFile.new(path)
53
+ manifest = jar.getManifest
54
+
55
+ pom_entries = jar.entries.select { |t| t.getName.start_with?("META-INF/maven/") && t.getName.end_with?("/pom.properties") }
56
+
57
+ # Some jar files have multiple maven pom.properties files. It is unclear how to know what is correct?
58
+ # TODO(sissel): Maybe we should use all pom.properties files? None of the pom.properties/pom.xml files have license information, though.
59
+ # TODO(sissel): In some cases, there are META-INF/COPYING and
60
+ # META-INF/NOTICE.txt files? Can we use these somehow? There is no
61
+ # common syntax for parsing these files, though...
62
+ pom_map = if pom_entries.count == 1
63
+ pom_in = jar.getInputStream(pom_entries.first)
64
+ pom_content = pom_in.available.times.collect { pom_in.read }.pack("C*")
65
+ # Split non-comment lines by `key=val` into a map { key => val }
66
+ Hash[pom_content.split(/\r?\n/).grep(/^[^#]/).map { |line| line.split("=", 2) }]
67
+ else
68
+ {}
69
+ end
70
+
71
+ next if manifest.nil?
72
+ # convert manifest attributes to a map w/ keys .to_s
73
+ # without this, the attribute keys will be `Object#inspect` values
74
+ # like #<Java::JavaUtilJar::Attributes::Name0xabcdef0>
75
+ attributes = Hash[manifest.getMainAttributes.map { |k,v| [k.to_s, v] }]
76
+
77
+ begin
78
+ # Prefer the maven/pom groupId when it is available.
79
+ artifact = pom_map.fetch("artifactId", attributes.fetch("Implementation-Title"))
80
+ group = pom_map.fetch("groupId", attributes.fetch("Implementation-Vendor-Id"))
81
+ jars << [
82
+ group + ":" + artifact,
83
+ attributes.fetch("Bundle-Version"),
84
+ attributes.fetch("Bundle-DocURL"),
85
+ SPDX.map(attributes.fetch("Bundle-License")),
86
+ ]
87
+ rescue KeyError => e
88
+ # The jar is missing a required manifest field, it may not have any useful manifest data.
89
+ # Ignore it and move on.
90
+ end
91
+ end
92
+ end
93
+ jars.uniq.sort
94
+ end
95
+
96
+ module SPDX
97
+ # This is a non-exhaustive, best effort list of licenses as they map to SPDX identifiers.
98
+ ALIASES = {
99
+ "Apache-2.0" => [
100
+ "Apache 2",
101
+ "apache-2.0",
102
+ "Apache 2.0",
103
+ "Apache License (2.0)",
104
+ "Apache License 2.0",
105
+ "https://www.apache.org/licenses/LICENSE-2.0.txt",
106
+ "http://www.apache.org/licenses/LICENSE-2.0.txt",
107
+ ],
108
+ "Artistic-2.0" => [
109
+ "Artistic 2.0"
110
+ ],
111
+ "BSD-2-Clause" => [
112
+ "2-clause BSDL",
113
+ "2-clause"
114
+ ],
115
+ "GPL-2.0" => [
116
+ "GPL-2"
117
+ ]
118
+ }
119
+
120
+ # Get a map of name => spdx
121
+ MAP_APACHE2 = Hash[ALIASES.map { |spdx,aliases| aliases.map { |value| [value, spdx] } }[0]]
122
+ MAP_ARTISTIC2 = Hash[ALIASES.map { |spdx,aliases| aliases.map { |value| [value, spdx] } }[1]]
123
+ MAP_BSD = Hash[ALIASES.map { |spdx,aliases| aliases.map { |value| [value, spdx] } }[2]]
124
+ MAP_GPL2 = Hash[ALIASES.map { |spdx,aliases| aliases.map { |value| [value, spdx] } }[3]]
125
+
126
+ module_function
127
+ def map(value)
128
+ MAP_APACHE2[value] || MAP_ARTISTIC2[value] || MAP_BSD[value] || MAP_GPL2[value] || value
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,17 @@
1
+ require_relative "../../../lib/bootstrap/environment"
2
+
3
+ if $0 == __FILE__
4
+ begin
5
+ LogStash::Bundler.setup!({:without => [:build, :development]})
6
+ rescue => Bundler::GemfileNotFound
7
+ $stderr.puts("No Gemfile found. Maybe you need to run `rake artifact:tar`?")
8
+ raise
9
+ end
10
+
11
+ require "logstash/namespace"
12
+ require_relative "../../../lib/bootstrap/patches/jar_dependencies"
13
+ require "logstash/dependency_report"
14
+
15
+ exit_status = LogStash::DependencyReport.run
16
+ exit(exit_status || 0)
17
+ end
@@ -3,6 +3,34 @@ require "spec_helper"
3
3
  require "logstash/config/mixin"
4
4
 
5
5
  describe LogStash::Config::Mixin do
6
+ context "when encountering a deprecated option" do
7
+ let(:password) { "sekret" }
8
+ let(:double_logger) { double("logger").as_null_object }
9
+
10
+ subject do
11
+ Class.new(LogStash::Filters::Base) do
12
+ include LogStash::Config::Mixin
13
+ config_name "test_deprecated"
14
+ milestone 1
15
+ config :old_opt, :validate => :string, :deprecated => "this is old school"
16
+ config :password, :validate => :password
17
+ end.new({
18
+ "old_opt" => "whut",
19
+ "password" => password
20
+ })
21
+ end
22
+
23
+ it "should not log the password" do
24
+ expect(LogStash::Logging::Logger).to receive(:new).with(anything).and_return(double_logger)
25
+ expect(double_logger).to receive(:warn) do |arg1,arg2|
26
+ message = 'You are using a deprecated config setting "old_opt" set in test_deprecated. Deprecated settings will continue to work, but are scheduled for removal from logstash in the future. this is old school If you have any questions about this, please visit the #logstash channel on freenode irc.'
27
+ expect(arg1).to eq(message)
28
+ expect(arg2[:plugin].to_s).to include('"password"=><password>')
29
+ end.once
30
+ subject
31
+ end
32
+ end
33
+
6
34
  context "when validating :bytes successfully" do
7
35
  subject do
8
36
  local_num_bytes = num_bytes # needs to be locally scoped :(
@@ -30,6 +30,10 @@ describe LogStash::Timestamp do
30
30
  expect{LogStash::Timestamp.new("foobar")}.to raise_error
31
31
  end
32
32
 
33
+ it "should copy itself correctly on clone and dup" do
34
+ expect(LogStash::Timestamp.now.clone.to_java).not_to be_nil
35
+ expect(LogStash::Timestamp.now.dup.to_java).not_to be_nil
36
+ end
33
37
  end
34
38
 
35
39
  end
@@ -1,7 +1,7 @@
1
1
  ---
2
- logstash: 5.6.5
3
- logstash-core: 5.6.5
4
- logstash-core-plugin-api: 2.1.12
2
+ logstash: 5.6.6
3
+ logstash-core: 5.6.6
4
+ logstash-core-plugin-api: 2.1.29
5
5
 
6
6
  # Note: this file is copied to the root of logstash-core because its gemspec needs it when
7
7
  # bundler evaluates the gemspec via bin/logstash
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.5
4
+ version: 5.6.6
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-04 00:00:00.000000000 Z
11
+ date: 2018-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -373,6 +373,8 @@ files:
373
373
  - lib/logstash/config/modules_common.rb
374
374
  - lib/logstash/config/source/modules.rb
375
375
  - lib/logstash/config/string_escape.rb
376
+ - lib/logstash/dependency_report.rb
377
+ - lib/logstash/dependency_report_runner.rb
376
378
  - lib/logstash/elasticsearch_client.rb
377
379
  - lib/logstash/environment.rb
378
380
  - lib/logstash/errors.rb