logstash-core 6.3.2-java → 6.4.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/agent.rb +10 -6
- data/lib/logstash/api/modules/logging.rb +4 -0
- data/lib/logstash/api/service.rb +0 -1
- data/lib/logstash/bootstrap_check/default_config.rb +0 -2
- data/lib/logstash/bootstrap_check/persisted_queue_config.rb +0 -1
- data/lib/logstash/codecs/base.rb +2 -4
- data/lib/logstash/compiler.rb +2 -3
- data/lib/logstash/compiler/lscl.rb +0 -1
- data/lib/logstash/config/config_ast.rb +0 -1
- data/lib/logstash/config/cpu_core_strategy.rb +0 -1
- data/lib/logstash/config/defaults.rb +0 -1
- data/lib/logstash/config/file.rb +0 -2
- data/lib/logstash/config/mixin.rb +4 -7
- data/lib/logstash/config/modules_common.rb +0 -2
- data/lib/logstash/config/source/local.rb +1 -3
- data/lib/logstash/config/source/modules.rb +0 -2
- data/lib/logstash/config/source/multi_local.rb +0 -1
- data/lib/logstash/config/source_loader.rb +1 -2
- data/lib/logstash/dependency_report.rb +19 -6
- data/lib/logstash/elasticsearch_client.rb +0 -2
- data/lib/logstash/environment.rb +3 -2
- data/lib/logstash/errors.rb +1 -15
- data/lib/logstash/event.rb +0 -1
- data/lib/logstash/event_dispatcher.rb +1 -40
- data/lib/logstash/execution_context.rb +2 -19
- data/lib/logstash/filters/base.rb +0 -2
- data/lib/logstash/inputs/base.rb +2 -4
- data/lib/logstash/inputs/threadable.rb +2 -3
- data/lib/logstash/instrument/collector.rb +0 -2
- data/lib/logstash/instrument/metric.rb +1 -105
- data/lib/logstash/instrument/namespaced_metric.rb +1 -58
- data/lib/logstash/instrument/namespaced_null_metric.rb +1 -58
- data/lib/logstash/instrument/null_metric.rb +2 -71
- data/lib/logstash/instrument/periodic_poller/base.rb +0 -1
- data/lib/logstash/instrument/periodic_poller/cgroup.rb +0 -1
- data/lib/logstash/java_pipeline.rb +33 -222
- data/lib/logstash/json.rb +0 -1
- data/lib/logstash/logging.rb +0 -2
- data/lib/logstash/logging/logger.rb +1 -159
- data/lib/logstash/modules/cli_parser.rb +0 -4
- data/lib/logstash/modules/elasticsearch_config.rb +0 -3
- data/lib/logstash/modules/elasticsearch_importer.rb +0 -3
- data/lib/logstash/modules/elasticsearch_resource.rb +0 -1
- data/lib/logstash/modules/file_reader.rb +0 -2
- data/lib/logstash/modules/kibana_base.rb +0 -1
- data/lib/logstash/modules/kibana_client.rb +0 -2
- data/lib/logstash/modules/kibana_config.rb +0 -3
- data/lib/logstash/modules/kibana_dashboards.rb +0 -2
- data/lib/logstash/modules/kibana_importer.rb +0 -3
- data/lib/logstash/modules/kibana_resource.rb +0 -1
- data/lib/logstash/modules/kibana_settings.rb +0 -2
- data/lib/logstash/modules/logstash_config.rb +0 -1
- data/lib/logstash/modules/resource_base.rb +0 -1
- data/lib/logstash/modules/scaffold.rb +0 -3
- data/lib/logstash/modules/settings_merger.rb +0 -2
- data/lib/logstash/namespace.rb +2 -15
- data/lib/logstash/outputs/base.rb +3 -5
- data/lib/logstash/patches/clamp.rb +6 -0
- data/lib/logstash/pipeline.rb +38 -180
- data/lib/logstash/pipeline_action/create.rb +0 -2
- data/lib/logstash/pipeline_action/reload.rb +1 -4
- data/lib/logstash/pipeline_action/stop.rb +0 -2
- data/lib/logstash/pipeline_reporter.rb +2 -108
- data/lib/logstash/plugin.rb +4 -7
- data/lib/logstash/plugins/hooks_registry.rb +1 -63
- data/lib/logstash/plugins/registry.rb +3 -2
- data/lib/logstash/runner.rb +6 -7
- data/lib/logstash/settings.rb +4 -5
- data/lib/logstash/shutdown_watcher.rb +0 -119
- data/lib/logstash/universal_plugin.rb +1 -13
- data/lib/logstash/util.rb +0 -1
- data/lib/logstash/util/buftok.rb +1 -139
- data/lib/logstash/util/byte_value.rb +2 -3
- data/lib/logstash/util/charset.rb +0 -1
- data/lib/logstash/util/cloud_setting_auth.rb +0 -1
- data/lib/logstash/util/cloud_setting_id.rb +20 -8
- data/lib/logstash/util/dead_letter_queue_manager.rb +2 -61
- data/lib/logstash/util/decorators.rb +0 -1
- data/lib/logstash/util/loggable.rb +1 -31
- data/lib/logstash/util/modules_setting_array.rb +2 -2
- data/lib/logstash/util/password.rb +0 -1
- data/lib/logstash/util/plugin_version.rb +0 -1
- data/lib/logstash/util/safe_uri.rb +7 -8
- data/lib/logstash/util/secretstore.rb +1 -38
- data/lib/logstash/util/substitution_variables.rb +4 -5
- data/lib/logstash/util/worker_threads_default_printer.rb +0 -1
- data/locales/en.yml +28 -1
- data/spec/logstash/config/mixin_spec.rb +4 -4
- data/spec/logstash/converge_result_spec.rb +0 -1
- data/spec/logstash/event_dispatcher_spec.rb +0 -2
- data/spec/logstash/event_spec.rb +22 -26
- data/spec/logstash/execution_context_spec.rb +0 -2
- data/spec/logstash/filter_delegator_spec.rb +12 -28
- data/spec/logstash/inputs/base_spec.rb +4 -5
- data/spec/logstash/instrument/metric_spec.rb +0 -1
- data/spec/logstash/instrument/namespaced_metric_spec.rb +0 -2
- data/spec/logstash/instrument/namespaced_null_metric_spec.rb +1 -3
- data/spec/logstash/instrument/null_metric_spec.rb +1 -4
- data/spec/logstash/instrument/periodic_poller/base_spec.rb +0 -1
- data/spec/logstash/instrument/periodic_poller/os_spec.rb +0 -1
- data/spec/logstash/instrument/wrapped_write_client_spec.rb +0 -1
- data/spec/logstash/java_filter_delegator_spec.rb +0 -3
- data/spec/logstash/java_integration_spec.rb +0 -1
- data/spec/logstash/java_pipeline_spec.rb +1 -4
- data/spec/logstash/modules/cli_parser_spec.rb +1 -3
- data/spec/logstash/modules/scaffold_spec.rb +0 -1
- data/spec/logstash/outputs/base_spec.rb +9 -10
- data/spec/logstash/pipeline_action/create_spec.rb +2 -3
- data/spec/logstash/pipeline_action/reload_spec.rb +1 -2
- data/spec/logstash/pipeline_action/stop_spec.rb +0 -1
- data/spec/logstash/pipeline_dlq_commit_spec.rb +0 -6
- data/spec/logstash/pipeline_reporter_spec.rb +18 -4
- data/spec/logstash/pipeline_spec.rb +2 -6
- data/spec/logstash/plugin_spec.rb +1 -2
- data/spec/logstash/plugins/hooks_registry_spec.rb +0 -2
- data/spec/logstash/queue_factory_spec.rb +0 -1
- data/spec/logstash/runner_spec.rb +16 -9
- data/spec/logstash/settings/modules_spec.rb +3 -3
- data/spec/logstash/shutdown_watcher_spec.rb +0 -27
- data/spec/logstash/state_resolver_spec.rb +0 -1
- data/spec/logstash/util/buftok_spec.rb +0 -1
- data/spec/logstash/util/cloud_setting_id_spec.rb +55 -2
- data/spec/logstash/util/secretstore_spec.rb +10 -10
- data/spec/logstash/util/wrapped_synchronous_queue_spec.rb +2 -2
- data/versions-gem-copy.yml +2 -2
- metadata +2 -16
- data/lib/logstash/bootstrap_check/bad_java.rb +0 -16
- data/lib/logstash/bootstrap_check/bad_ruby.rb +0 -12
- data/lib/logstash/converge_result.rb +0 -103
- data/lib/logstash/instrument/global_metrics.rb +0 -13
- data/lib/logstash/instrument/snapshot.rb +0 -15
- data/lib/logstash/java_integration.rb +0 -116
- data/lib/logstash/logging/json.rb +0 -21
- data/lib/logstash/plugins/plugin_factory.rb +0 -107
- data/lib/logstash/queue_factory.rb +0 -34
- data/lib/logstash/util/retryable.rb +0 -40
- data/spec/logstash/output_delegator_spec.rb +0 -201
- data/spec/logstash/timestamp_spec.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e766866b8e8de1c59212aab21120296be4a2b3768e736e9fc7fae7851d6687
|
4
|
+
data.tar.gz: 6c9f88892074eaa5c909df9365f94e58e5ec6781c559268b72fdc3c47f59be57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dc2bdc1806597be02fd49c75f7c2060543b5decbbb6c5657d680798d2092cabce49044fe8d08490a0ee37f507f4ff5bed5c71b21e72790a81b99e143a58c52d
|
7
|
+
data.tar.gz: 482cbc47fc99ff43101b28bf0f6fff6488fe1faeeea717a1934afd8dde672d4efd523a7f56749bc4f3822628029ac39b525f66e9d0a6c1207e7cc5292793effb
|
data/lib/logstash/agent.rb
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/environment"
|
3
|
-
require "logstash/errors"
|
4
3
|
require "logstash/config/cpu_core_strategy"
|
5
4
|
require "logstash/instrument/collector"
|
6
|
-
require "logstash/instrument/metric"
|
7
5
|
require "logstash/instrument/periodic_pollers"
|
8
|
-
require "logstash/instrument/collector"
|
9
|
-
require "logstash/instrument/metric"
|
10
6
|
require "logstash/pipeline"
|
11
7
|
require "logstash/webserver"
|
12
|
-
require "logstash/event_dispatcher"
|
13
8
|
require "logstash/config/source_loader"
|
14
9
|
require "logstash/pipeline_action"
|
15
|
-
require "logstash/converge_result"
|
16
10
|
require "logstash/state_resolver"
|
17
11
|
require "stud/trap"
|
18
12
|
require "uri"
|
@@ -51,6 +45,16 @@ class LogStash::Agent
|
|
51
45
|
# Generate / load the persistent uuid
|
52
46
|
id
|
53
47
|
|
48
|
+
# Set the global FieldReference parsing mode
|
49
|
+
parsing_mode = case setting('config.field_reference.parser')
|
50
|
+
when 'COMPAT' then org.logstash.FieldReference::ParsingMode::COMPAT;
|
51
|
+
when 'LEGACY' then org.logstash.FieldReference::ParsingMode::LEGACY;
|
52
|
+
when 'STRICT' then org.logstash.FieldReference::ParsingMode::STRICT;
|
53
|
+
else fail('Unsupported FieldReference parsing mode')
|
54
|
+
end
|
55
|
+
logger.debug("Setting global FieldReference parsing mode: #{parsing_mode}")
|
56
|
+
org.logstash.FieldReference::set_parsing_mode(parsing_mode)
|
57
|
+
|
54
58
|
# This is for backward compatibility in the tests
|
55
59
|
if source_loader.nil?
|
56
60
|
@source_loader = LogStash::Config::SourceLoader.new
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
#
|
3
3
|
java_import org.apache.logging.log4j.core.LoggerContext
|
4
|
+
java_import java.lang.IllegalArgumentException
|
4
5
|
|
5
6
|
module LogStash
|
6
7
|
module Api
|
@@ -30,6 +31,9 @@ module LogStash
|
|
30
31
|
raise ArgumentError, I18n.t("logstash.web_api.logging.unrecognized_option", :option => remaining.keys.first)
|
31
32
|
end
|
32
33
|
respond_with({"acknowledged" => true})
|
34
|
+
rescue IllegalArgumentException => e
|
35
|
+
status 400
|
36
|
+
respond_with({"error" => e.message})
|
33
37
|
rescue ArgumentError => e
|
34
38
|
status 400
|
35
39
|
respond_with({"error" => e.message})
|
data/lib/logstash/api/service.rb
CHANGED
data/lib/logstash/codecs/base.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require "logstash/namespace"
|
3
2
|
require "logstash/event"
|
4
3
|
require "logstash/plugin"
|
5
|
-
require "logstash/logging"
|
6
4
|
|
7
5
|
# This is the base class for logstash codecs.
|
8
6
|
module LogStash::Codecs; class Base < LogStash::Plugin
|
@@ -41,12 +39,12 @@ module LogStash::Codecs; class Base < LogStash::Plugin
|
|
41
39
|
# over the current API for shared plugins
|
42
40
|
# It is best if the codec implements this directly
|
43
41
|
def multi_encode(events)
|
44
|
-
if @has_encode_sync
|
42
|
+
if @has_encode_sync
|
45
43
|
events.map {|event| [event, self.encode_sync(event)]}
|
46
44
|
else
|
47
45
|
batch = Thread.current[:logstash_output_codec_batch] ||= []
|
48
46
|
batch.clear
|
49
|
-
|
47
|
+
|
50
48
|
events.each {|event| self.encode(event) }
|
51
49
|
batch
|
52
50
|
end
|
data/lib/logstash/compiler.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'logstash/util/loggable'
|
2
1
|
require 'logstash/compiler/lscl/lscl_grammar'
|
3
2
|
|
4
3
|
java_import org.logstash.config.ir.PipelineIR
|
@@ -15,10 +14,10 @@ module LogStash; class Compiler
|
|
15
14
|
input_graph = Graph.combine(*graph_sections.map {|s| s[:input] }).graph
|
16
15
|
output_graph = Graph.combine(*graph_sections.map {|s| s[:output] }).graph
|
17
16
|
|
18
|
-
filter_graph = graph_sections.reduce(nil) do |acc, s|
|
17
|
+
filter_graph = graph_sections.reduce(nil) do |acc, s|
|
19
18
|
filter_section = s[:filter]
|
20
19
|
|
21
|
-
if acc.nil?
|
20
|
+
if acc.nil?
|
22
21
|
filter_section
|
23
22
|
else
|
24
23
|
acc.chain(filter_section)
|
data/lib/logstash/config/file.rb
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require "logstash/namespace"
|
3
|
-
require "logstash/plugins/registry"
|
4
|
-
require "logstash/logging"
|
5
2
|
require "logstash/util/password"
|
6
3
|
require "logstash/util/safe_uri"
|
7
4
|
require "logstash/version"
|
@@ -33,21 +30,21 @@ LogStash::Environment.load_locale!
|
|
33
30
|
# }
|
34
31
|
#
|
35
32
|
module LogStash::Config::Mixin
|
36
|
-
|
33
|
+
|
37
34
|
include LogStash::Util::SubstitutionVariables
|
38
|
-
|
35
|
+
|
39
36
|
attr_accessor :config
|
40
37
|
attr_accessor :original_params
|
41
38
|
|
42
39
|
PLUGIN_VERSION_1_0_0 = LogStash::Util::PluginVersion.new(1, 0, 0)
|
43
40
|
PLUGIN_VERSION_0_9_0 = LogStash::Util::PluginVersion.new(0, 9, 0)
|
44
|
-
|
41
|
+
|
45
42
|
# This method is called when someone does 'include LogStash::Config'
|
46
43
|
def self.included(base)
|
47
44
|
# Add the DSL methods to the 'base' given.
|
48
45
|
base.extend(LogStash::Config::Mixin::DSL)
|
49
46
|
end
|
50
|
-
|
47
|
+
|
51
48
|
def config_init(params)
|
52
49
|
# Validation will modify the values inside params if necessary.
|
53
50
|
# For example: converting a string to a number, etc.
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require "logstash/util/loggable"
|
3
2
|
require "logstash/elasticsearch_client"
|
4
3
|
require "logstash/modules/kibana_client"
|
5
4
|
require "logstash/modules/elasticsearch_importer"
|
6
5
|
require "logstash/modules/kibana_importer"
|
7
6
|
require "logstash/modules/settings_merger"
|
8
|
-
require "logstash/errors"
|
9
7
|
|
10
8
|
module LogStash module Config
|
11
9
|
class ModulesCommon # extracted here for bwc with 5.x
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/config/source/base"
|
3
3
|
require "logstash/config/pipeline_config"
|
4
|
-
require "logstash/util/loggable"
|
5
|
-
require "logstash/errors"
|
6
4
|
require "uri"
|
7
5
|
|
8
6
|
module LogStash module Config module Source
|
@@ -72,7 +70,7 @@ module LogStash module Config module Source
|
|
72
70
|
|
73
71
|
config_string = ::File.read(file)
|
74
72
|
config_string.force_encoding("UTF-8")
|
75
|
-
|
73
|
+
|
76
74
|
if config_string.valid_encoding?
|
77
75
|
part = org.logstash.common.SourceWithMetadata.new("file", file, 0, 0, config_string)
|
78
76
|
config_parts << part
|
@@ -2,7 +2,6 @@
|
|
2
2
|
require "logstash/config/source/local"
|
3
3
|
require "logstash/config/source/modules"
|
4
4
|
require "logstash/config/source/multi_local"
|
5
|
-
require "logstash/errors"
|
6
5
|
require "thread"
|
7
6
|
require "set"
|
8
7
|
|
@@ -53,7 +52,7 @@ module LogStash module Config
|
|
53
52
|
# This shouldn't happen with the settings object or with any external plugins.
|
54
53
|
# but lets add a guard so we fail fast.
|
55
54
|
@sources_lock.synchronize do
|
56
|
-
|
55
|
+
logger.error "No source loaders matched! This shouldn't happen", :sources => @sources
|
57
56
|
end
|
58
57
|
raise LogStash::InvalidSourceLoaderSettingError, "Can't find an appropriate config loader with current settings"
|
59
58
|
else
|
@@ -6,6 +6,8 @@ $DEBUGLIST = (ENV["DEBUG"] || "").split(",")
|
|
6
6
|
require "clamp"
|
7
7
|
require "rubygems"
|
8
8
|
require "jars/gemspec_artifacts"
|
9
|
+
require 'fileutils'
|
10
|
+
require 'securerandom'
|
9
11
|
|
10
12
|
class LogStash::DependencyReport < Clamp::Command
|
11
13
|
option [ "--csv" ], "OUTPUT_PATH", "The path to write the dependency report in csv format.",
|
@@ -13,19 +15,30 @@ class LogStash::DependencyReport < Clamp::Command
|
|
13
15
|
|
14
16
|
def execute
|
15
17
|
require "csv"
|
16
|
-
|
18
|
+
|
19
|
+
tmp_dir = java.lang.System.getProperty("java.io.tmpdir")
|
20
|
+
ruby_output_path = File.join(tmp_dir, SecureRandom.uuid)
|
21
|
+
# Write a CSV with just the ruby stuff
|
22
|
+
CSV.open(ruby_output_path, "wb", :headers => [ "name", "version", "url", "license" ], :write_headers => true) do |csv|
|
17
23
|
puts "Finding gem dependencies"
|
18
24
|
gems.each { |d| csv << d }
|
19
|
-
puts "Finding java/jar dependencies"
|
25
|
+
puts "Finding gem embedded java/jar dependencies"
|
20
26
|
jars.each { |d| csv << d }
|
21
27
|
end
|
28
|
+
puts "Wrote temporary ruby deps CSV to #{ruby_output_path}"
|
22
29
|
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
# Use gradle to find the rest and add to the ruby CSV
|
31
|
+
puts "Find gradle jar dependencies #{Dir.pwd}"
|
32
|
+
command = ["./gradlew", "generateLicenseReport", "-PlicenseReportInputCSV=#{ruby_output_path}", "-PlicenseReportOutputCSV=#{output_path}"]
|
33
|
+
puts "Executing #{command}"
|
34
|
+
system(*command)
|
35
|
+
if $?.exitstatus != 0
|
36
|
+
raise "Could not run gradle java deps! Exit status #{$?.exitstatus}"
|
27
37
|
end
|
38
|
+
|
28
39
|
nil
|
40
|
+
ensure
|
41
|
+
FileUtils.rm(ruby_output_path) if ruby_output_path
|
29
42
|
end
|
30
43
|
|
31
44
|
def gems
|
data/lib/logstash/environment.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash-core/logstash-core"
|
3
|
-
require "logstash/errors"
|
4
|
-
require "logstash/java_integration"
|
5
3
|
require "logstash/config/cpu_core_strategy"
|
6
4
|
require "logstash/settings"
|
7
5
|
require "logstash/util/cloud_setting_id"
|
@@ -26,6 +24,8 @@ module LogStash
|
|
26
24
|
Setting::NullableString.new("config.string", nil, false),
|
27
25
|
Setting::Modules.new("modules.cli", LogStash::Util::ModulesSettingArray, []),
|
28
26
|
Setting::Modules.new("modules", LogStash::Util::ModulesSettingArray, []),
|
27
|
+
Setting.new("modules_list", Array, []),
|
28
|
+
Setting.new("modules_variable_list", Array, []),
|
29
29
|
Setting::Modules.new("cloud.id", LogStash::Util::CloudSettingId),
|
30
30
|
Setting::Modules.new("cloud.auth",LogStash::Util::CloudSettingAuth),
|
31
31
|
Setting::Boolean.new("modules_setup", false),
|
@@ -33,6 +33,7 @@ module LogStash
|
|
33
33
|
Setting::Boolean.new("config.reload.automatic", false),
|
34
34
|
Setting::TimeValue.new("config.reload.interval", "3s"), # in seconds
|
35
35
|
Setting::Boolean.new("config.support_escapes", false),
|
36
|
+
Setting::String.new("config.field_reference.parser", "COMPAT", true, %w(STRICT COMPAT LEGACY)),
|
36
37
|
Setting::Boolean.new("metric.collect", true),
|
37
38
|
Setting::String.new("pipeline.id", "main"),
|
38
39
|
Setting::Boolean.new("pipeline.system", false),
|
data/lib/logstash/errors.rb
CHANGED
@@ -1,15 +1 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
module LogStash
|
4
|
-
class EnvironmentError < Error; end
|
5
|
-
class ConfigurationError < Error; end
|
6
|
-
class PluginLoadingError < Error; end
|
7
|
-
class ShutdownSignal < StandardError; end
|
8
|
-
class PluginNoVersionError < Error; end
|
9
|
-
class BootstrapCheckError < Error; end
|
10
|
-
|
11
|
-
class Bug < Error; end
|
12
|
-
class ThisMethodWasRemoved < Bug; end
|
13
|
-
class ConfigLoadingError < Error; end
|
14
|
-
class InvalidSourceLoaderSettingError < Error; end
|
15
|
-
end
|
1
|
+
# Keeping this file for backwards compatibility with plugins that include it directly.
|
data/lib/logstash/event.rb
CHANGED
@@ -1,40 +1 @@
|
|
1
|
-
#
|
2
|
-
module LogStash
|
3
|
-
class EventDispatcher
|
4
|
-
java_import "java.util.concurrent.CopyOnWriteArraySet"
|
5
|
-
|
6
|
-
attr_reader :emitter
|
7
|
-
|
8
|
-
def initialize(emitter)
|
9
|
-
@emitter = emitter
|
10
|
-
@listeners = CopyOnWriteArraySet.new
|
11
|
-
end
|
12
|
-
|
13
|
-
# This operation is slow because we use a CopyOnWriteArrayList
|
14
|
-
# But the majority of the addition will be done at bootstrap time
|
15
|
-
# So add_listener shouldn't be called often at runtime.
|
16
|
-
#
|
17
|
-
# On the other hand the notification could be called really often.
|
18
|
-
def add_listener(listener)
|
19
|
-
@listeners.add(listener)
|
20
|
-
end
|
21
|
-
|
22
|
-
# This operation is slow because we use a `CopyOnWriteArrayList` as the backend, instead of a
|
23
|
-
# ConcurrentHashMap, but since we are mostly adding stuff and iterating the `CopyOnWriteArrayList`
|
24
|
-
# should provide a better performance.
|
25
|
-
#
|
26
|
-
# See note on add_listener, this method shouldn't be called really often.
|
27
|
-
def remove_listener(listener)
|
28
|
-
@listeners.remove(listener)
|
29
|
-
end
|
30
|
-
|
31
|
-
def fire(method_name, *arguments)
|
32
|
-
@listeners.each do |listener|
|
33
|
-
if listener.respond_to?(method_name)
|
34
|
-
listener.send(method_name, emitter, *arguments)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
alias_method :execute, :fire
|
39
|
-
end
|
40
|
-
end
|
1
|
+
# Keeping this file for backwards compatibility with plugins that include it directly.
|
@@ -1,19 +1,2 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
module LogStash
|
4
|
-
class ExecutionContext
|
5
|
-
attr_reader :pipeline, :agent, :dlq_writer
|
6
|
-
|
7
|
-
def initialize(pipeline, agent, plugin_id, plugin_type, dlq_writer)
|
8
|
-
@pipeline = pipeline
|
9
|
-
@agent = agent
|
10
|
-
@plugin_id = plugin_id
|
11
|
-
@plugin_type = plugin_type
|
12
|
-
@dlq_writer = LogStash::Util::PluginDeadLetterQueueWriter.new(dlq_writer, @plugin_id, @plugin_type)
|
13
|
-
end
|
14
|
-
|
15
|
-
def pipeline_id
|
16
|
-
@pipeline.pipeline_id
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
# The contents of this file have been ported to Java. It is included for for compatibility
|
2
|
+
# with plugins that directly include it.
|