logstash-core 5.0.0.alpha2.snapshot2-java → 5.0.0.alpha3-java

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of logstash-core might be problematic. Click here for more details.

Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/logstash-core/version.rb +1 -1
  3. data/lib/logstash/agent.rb +48 -31
  4. data/lib/logstash/api/{lib/helpers/app_helpers.rb → app_helpers.rb} +0 -0
  5. data/lib/logstash/api/command_factory.rb +34 -0
  6. data/lib/logstash/api/commands/base.rb +25 -0
  7. data/lib/logstash/api/commands/stats.rb +105 -0
  8. data/lib/logstash/api/commands/system/basicinfo_command.rb +23 -0
  9. data/lib/logstash/api/commands/system/plugins_command.rb +35 -0
  10. data/lib/logstash/api/modules/base.rb +43 -0
  11. data/lib/logstash/api/modules/node.rb +24 -0
  12. data/lib/logstash/api/modules/node_stats.rb +59 -0
  13. data/lib/logstash/api/modules/plugins.rb +15 -0
  14. data/lib/logstash/api/modules/root.rb +15 -0
  15. data/lib/logstash/api/modules/stats.rb +63 -0
  16. data/lib/logstash/api/rack_app.rb +33 -0
  17. data/lib/logstash/api/service.rb +73 -0
  18. data/lib/logstash/config/config_ast.rb +23 -18
  19. data/lib/logstash/config/loader.rb +4 -4
  20. data/lib/logstash/config/mixin.rb +10 -21
  21. data/lib/logstash/environment.rb +29 -0
  22. data/lib/logstash/filters/base.rb +2 -2
  23. data/lib/logstash/inputs/base.rb +2 -2
  24. data/lib/logstash/instrument/collector.rb +1 -1
  25. data/lib/logstash/instrument/metric_store.rb +11 -1
  26. data/lib/logstash/instrument/periodic_poller/base.rb +2 -0
  27. data/lib/logstash/instrument/periodic_poller/jvm.rb +47 -2
  28. data/lib/logstash/logging/json.rb +21 -0
  29. data/lib/logstash/output_delegator.rb +2 -2
  30. data/lib/logstash/patches/clamp.rb +69 -0
  31. data/lib/logstash/pipeline.rb +36 -69
  32. data/lib/logstash/plugin.rb +1 -1
  33. data/lib/logstash/runner.rb +171 -146
  34. data/lib/logstash/settings.rb +267 -0
  35. data/lib/logstash/util/decorators.rb +6 -6
  36. data/lib/logstash/util/java_version.rb +1 -10
  37. data/lib/logstash/util/thread_dump.rb +55 -0
  38. data/lib/logstash/util/worker_threads_default_printer.rb +2 -2
  39. data/lib/logstash/version.rb +1 -1
  40. data/lib/logstash/webserver.rb +15 -49
  41. data/locales/en.yml +22 -25
  42. data/logstash-core.gemspec +3 -3
  43. data/spec/api/lib/api/node_spec.rb +2 -2
  44. data/spec/api/lib/api/node_stats_spec.rb +32 -57
  45. data/spec/api/lib/api/plugins_spec.rb +3 -3
  46. data/spec/api/lib/api/root_spec.rb +2 -2
  47. data/spec/api/lib/api/support/resource_dsl_methods.rb +47 -0
  48. data/spec/api/lib/commands/stats.rb +47 -0
  49. data/spec/api/spec_helper.rb +21 -21
  50. data/spec/conditionals_spec.rb +113 -113
  51. data/spec/logstash/agent_spec.rb +85 -68
  52. data/spec/logstash/config/config_ast_spec.rb +4 -2
  53. data/spec/logstash/config/mixin_spec.rb +33 -7
  54. data/spec/logstash/filters/base_spec.rb +16 -16
  55. data/spec/logstash/inputs/base_spec.rb +8 -8
  56. data/spec/logstash/instrument/periodic_poller/jvm_spec.rb +45 -0
  57. data/spec/logstash/output_delegator_spec.rb +2 -0
  58. data/spec/logstash/pipeline_reporter_spec.rb +5 -1
  59. data/spec/logstash/pipeline_spec.rb +75 -30
  60. data/spec/logstash/plugin_spec.rb +2 -2
  61. data/spec/logstash/runner_spec.rb +112 -25
  62. data/spec/logstash/setting_spec.rb +130 -0
  63. data/spec/logstash/settings_spec.rb +62 -0
  64. metadata +37 -43
  65. data/lib/logstash/api/init.ru +0 -31
  66. data/lib/logstash/api/lib/app.rb +0 -40
  67. data/lib/logstash/api/lib/app/command.rb +0 -29
  68. data/lib/logstash/api/lib/app/command_factory.rb +0 -29
  69. data/lib/logstash/api/lib/app/commands/stats/events_command.rb +0 -13
  70. data/lib/logstash/api/lib/app/commands/stats/hotthreads_command.rb +0 -120
  71. data/lib/logstash/api/lib/app/commands/stats/memory_command.rb +0 -25
  72. data/lib/logstash/api/lib/app/commands/system/basicinfo_command.rb +0 -15
  73. data/lib/logstash/api/lib/app/commands/system/plugins_command.rb +0 -28
  74. data/lib/logstash/api/lib/app/modules/node.rb +0 -25
  75. data/lib/logstash/api/lib/app/modules/node_stats.rb +0 -51
  76. data/lib/logstash/api/lib/app/modules/plugins.rb +0 -15
  77. data/lib/logstash/api/lib/app/modules/stats.rb +0 -21
  78. data/lib/logstash/api/lib/app/root.rb +0 -13
  79. data/lib/logstash/api/lib/app/service.rb +0 -61
  80. data/lib/logstash/api/lib/app/stats.rb +0 -56
  81. data/lib/logstash/util/defaults_printer.rb +0 -31
  82. data/spec/api/lib/api/stats_spec.rb +0 -19
  83. data/spec/api/lib/commands/events_spec.rb +0 -17
  84. data/spec/api/lib/commands/jvm_spec.rb +0 -45
  85. data/spec/logstash/util/defaults_printer_spec.rb +0 -50
  86. data/spec/logstash/util/worker_threads_default_printer_spec.rb +0 -45
@@ -1,7 +1,36 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/errors"
3
+ require "logstash/config/cpu_core_strategy"
4
+ require "logstash/settings"
3
5
 
4
6
  module LogStash
7
+
8
+ [
9
+ Setting::String.new("node.name", Socket.gethostname),
10
+ Setting::String.new("path.config", nil, false),
11
+ Setting::String.new("config.string", nil, false),
12
+ Setting::Boolean.new("config.test_and_exit", false),
13
+ Setting::Boolean.new("config.reload.automatic", false),
14
+ Setting::Numeric.new("config.reload.interval", 3),
15
+ Setting::Boolean.new("metric.collect", true) {|v| v == true }, # metric collection cannot be disabled
16
+ Setting::String.new("pipeline.id", "main"),
17
+ Setting::Numeric.new("pipeline.workers", LogStash::Config::CpuCoreStrategy.maximum),
18
+ Setting::Numeric.new("pipeline.output.workers", 1),
19
+ Setting::Numeric.new("pipeline.batch.size", 125),
20
+ Setting::Numeric.new("pipeline.batch.delay", 5), # in milliseconds
21
+ Setting::Boolean.new("pipeline.unsafe_shutdown", false),
22
+ Setting.new("path.plugins", Array, []),
23
+ Setting::String.new("interactive", nil, false),
24
+ Setting::Boolean.new("config.debug", false),
25
+ Setting::String.new("log.level", "warn", true, ["quiet", "verbose", "warn", "debug"]),
26
+ Setting::Boolean.new("version", false),
27
+ Setting::Boolean.new("help", false),
28
+ Setting::String.new("path.log", nil, false),
29
+ Setting::String.new("log.format", "plain", true, ["json", "plain"]),
30
+ Setting::String.new("http.host", "127.0.0.1"),
31
+ Setting::Port.new("http.port", 9600),
32
+ ].each {|setting| SETTINGS.register(setting) }
33
+
5
34
  module Environment
6
35
  extend self
7
36
 
@@ -187,12 +187,12 @@ class LogStash::Filters::Base < LogStash::Plugin
187
187
  # this is important because a construct like event["tags"].delete(tag) will not work
188
188
  # in the current Java event implementation. see https://github.com/elastic/logstash/issues/4140
189
189
  @remove_tag.each do |tag|
190
- tags = event["tags"]
190
+ tags = event.get("tags")
191
191
  break if tags.nil? || tags.empty?
192
192
  tag = event.sprintf(tag)
193
193
  @logger.debug? and @logger.debug("filters/#{self.class.name}: removing tag", :tag => tag)
194
194
  tags.delete(tag)
195
- event["tags"] = tags
195
+ event.set("tags", tags)
196
196
  end
197
197
  end # def filter_matched
198
198
 
@@ -83,7 +83,7 @@ class LogStash::Inputs::Base < LogStash::Plugin
83
83
 
84
84
  public
85
85
  def do_stop
86
- @logger.debug("stopping", :plugin => self)
86
+ @logger.debug("stopping", :plugin => self.class.name)
87
87
  @stop_called.make_true
88
88
  stop
89
89
  end
@@ -97,7 +97,7 @@ class LogStash::Inputs::Base < LogStash::Plugin
97
97
  protected
98
98
  def decorate(event)
99
99
  # Only set 'type' if not already set. This is backwards-compatible behavior
100
- event["type"] = @type if @type && !event.include?("type")
100
+ event.set("type", @type) if @type && !event.include?("type")
101
101
 
102
102
  LogStash::Util::Decorators.add_fields(@add_field,event,"inputs/#{self.class.name}")
103
103
  LogStash::Util::Decorators.add_tags(@tags,event,"inputs/#{self.class.name}")
@@ -75,7 +75,7 @@ module LogStash module Instrument
75
75
  logger.error("Collector: Something went wrong went sending data to the observers",
76
76
  :execution_time => time_of_execution,
77
77
  :result => result,
78
- :exception => exception)
78
+ :exception => exception.class.name)
79
79
  end
80
80
 
81
81
  # Snapshot the current Metric Store and return it immediately,
@@ -86,7 +86,7 @@ module LogStash module Instrument
86
86
 
87
87
  # Similar to `get_with_path` but use symbols instead of string
88
88
  #
89
- # @param [Array<Symbol>
89
+ # @param [Array<Symbol>]
90
90
  # @return [Hash]
91
91
  def get(*key_paths)
92
92
  # Normalize the symbols access
@@ -100,6 +100,16 @@ module LogStash module Instrument
100
100
  new_hash
101
101
  end
102
102
 
103
+ # Retrieve values like `get`, but don't return them fully nested.
104
+ # This means that if you call `get_shallow(:foo, :bar)` the result will not
105
+ # be nested inside of `{:foo {:bar => values}`.
106
+ #
107
+ # @param [Array<Symbol>]
108
+ # @return [Hash]
109
+ def get_shallow(*key_paths)
110
+ key_paths.reduce(get(*key_paths)) {|acc, p| acc[p]}
111
+ end
112
+
103
113
  # Return all the individuals Metric,
104
114
  # This call mimic a Enum's each if a block is provided
105
115
  #
@@ -37,6 +37,8 @@ module LogStash module Instrument module PeriodicPoller
37
37
  logger.debug("PeriodicPoller: Starting",
38
38
  :polling_interval => @options[:polling_interval],
39
39
  :polling_timeout => @options[:polling_timeout]) if logger.debug?
40
+
41
+ collect # Collect data right away if possible
40
42
  @task.execute
41
43
  end
42
44
 
@@ -1,6 +1,15 @@
1
+
1
2
  # encoding: utf-8
2
3
  require "logstash/instrument/periodic_poller/base"
3
- require 'monitoring'
4
+ require 'jrmonitor'
5
+
6
+ java_import 'java.lang.management.ManagementFactory'
7
+ java_import 'java.lang.management.OperatingSystemMXBean'
8
+ java_import 'com.sun.management.UnixOperatingSystemMXBean'
9
+ java_import 'javax.management.MBeanServer'
10
+ java_import 'javax.management.ObjectName'
11
+ java_import 'javax.management.AttributeList'
12
+ java_import 'javax.naming.directory.Attribute'
4
13
 
5
14
  module LogStash module Instrument module PeriodicPoller
6
15
  class JVM < Base
@@ -13,14 +22,50 @@ module LogStash module Instrument module PeriodicPoller
13
22
  end
14
23
 
15
24
  def collect
16
- raw = JRMonitor.memory.generate
25
+ raw = JRMonitor.memory.generate
17
26
  collect_heap_metrics(raw)
18
27
  collect_non_heap_metrics(raw)
19
28
  collect_pools_metrics(raw)
29
+ collect_threads_metrics
30
+ collect_process_metrics
20
31
  end
21
32
 
22
33
  private
23
34
 
35
+ def collect_threads_metrics
36
+ threads = JRMonitor.threads.generate
37
+
38
+ current = threads.count
39
+ if @peak_threads.nil? || @peak_threads < current
40
+ @peak_threads = current
41
+ end
42
+
43
+ metric.gauge([:jvm, :threads], :count, threads.count)
44
+ metric.gauge([:jvm, :threads], :peak_count, @peak_threads)
45
+ end
46
+
47
+ def collect_process_metrics
48
+ process_metrics = JRMonitor.process.generate
49
+
50
+ path = [:jvm, :process]
51
+
52
+
53
+ open_fds = process_metrics["open_file_descriptors"]
54
+ if @peak_open_fds.nil? || open_fds > @peak_open_fds
55
+ @peak_open_fds = open_fds
56
+ end
57
+ metric.gauge(path, :open_file_descriptors, open_fds)
58
+ metric.gauge(path, :peak_open_file_descriptors, @peak_open_fds)
59
+ metric.gauge(path, :max_file_descriptors, process_metrics["max_file_descriptors"])
60
+
61
+ cpu_path = path + [:cpu]
62
+ cpu_metrics = process_metrics["cpu"]
63
+ metric.gauge(cpu_path, :percent, cpu_metrics["process_percent"])
64
+ metric.gauge(cpu_path, :total_in_millis, cpu_metrics["total_in_millis"])
65
+
66
+ metric.gauge(path + [:mem], :total_virtual_in_bytes, process_metrics["mem"]["total_virtual_in_bytes"])
67
+ end
68
+
24
69
  def collect_heap_metrics(data)
25
70
  heap = aggregate_information_for(data["heap"].values)
26
71
  heap[:used_percent] = (heap[:used_in_bytes] / heap[:max_in_bytes].to_f)*100.0
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ require "logstash/namespace"
3
+ require "logstash/logging"
4
+ require "logstash/json"
5
+
6
+ module LogStash; class Logging; class JSON
7
+ def initialize(io)
8
+ raise ArgumentError, "Expected IO, got #{io.class.name}" unless io.is_a?(IO)
9
+
10
+ @io = io
11
+ @lock = Mutex.new
12
+ end
13
+
14
+ def <<(obj)
15
+ serialized = LogStash::Json.dump(obj)
16
+ @lock.synchronize do
17
+ @io.puts(serialized)
18
+ @io.flush
19
+ end
20
+ end
21
+ end; end; end
@@ -82,7 +82,7 @@ module LogStash class OutputDelegator
82
82
  @workers << @klass.new(@config)
83
83
  @workers.first.register # Needed in case register calls `workers_not_supported`
84
84
 
85
- @logger.debug("Will start workers for output", :worker_count => target_worker_count, :class => @klass)
85
+ @logger.debug("Will start workers for output", :worker_count => target_worker_count, :class => @klass.name)
86
86
 
87
87
  # Threadsafe versions don't need additional workers
88
88
  setup_additional_workers!(target_worker_count) unless @threadsafe
@@ -147,7 +147,7 @@ module LogStash class OutputDelegator
147
147
  end
148
148
 
149
149
  def do_close
150
- @logger.debug("closing output delegator", :klass => @klass)
150
+ @logger.debug("closing output delegator", :klass => @klass.name)
151
151
 
152
152
  if @threadsafe
153
153
  @workers.each(&:do_close)
@@ -0,0 +1,69 @@
1
+ require 'clamp'
2
+ require 'logstash/environment'
3
+
4
+ module Clamp
5
+ module Attribute
6
+ class Instance
7
+ def default_from_environment
8
+ # we don't want uncontrolled var injection from the environment
9
+ # since we're establishing that settings can be pulled from only three places:
10
+ # 1. default settings
11
+ # 2. yaml file
12
+ # 3. cli arguments
13
+ end
14
+ end
15
+ end
16
+
17
+ module Option
18
+
19
+ module StrictDeclaration
20
+
21
+ include Clamp::Attribute::Declaration
22
+
23
+ # Instead of letting Clamp set up accessors for the options
24
+ # weŕe going to tightly controlling them through
25
+ # LogStash::SETTINGS
26
+ def define_simple_writer_for(option, &block)
27
+ LogStash::SETTINGS.get(option.attribute_name)
28
+ define_method(option.write_method) do |value|
29
+ value = instance_exec(value, &block) if block
30
+ LogStash::SETTINGS.set_value(option.attribute_name, value)
31
+ end
32
+ end
33
+
34
+ def define_reader_for(option)
35
+ define_method(option.read_method) do
36
+ LogStash::SETTINGS.get_value(option.attribute_name)
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ class Definition
43
+ # Allow boolean flags to optionally receive a true/false argument
44
+ # to explicitly set them, i.e.
45
+ # --long.flag.name => sets flag to true
46
+ # --long.flag.name true => sets flag to true
47
+ # --long.flag.name false => sets flag to false
48
+ # --long.flag.name=true => sets flag to true
49
+ # --long.flag.name=false => sets flag to false
50
+ def extract_value(switch, arguments)
51
+ if flag? && (arguments.first.nil? || arguments.first.match("^-"))
52
+ flag_value(switch)
53
+ else
54
+ arguments.shift
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ # Create a subclass of Clamp::Command that enforces the use of
61
+ # LogStash::SETTINGS for setting validation
62
+ class StrictCommand < Command
63
+ class << self
64
+ include ::Clamp::Option::StrictDeclaration
65
+ end
66
+ end
67
+ end
68
+
69
+
@@ -9,8 +9,6 @@ require "logstash/config/file"
9
9
  require "logstash/filters/base"
10
10
  require "logstash/inputs/base"
11
11
  require "logstash/outputs/base"
12
- require "logstash/config/cpu_core_strategy"
13
- require "logstash/util/defaults_printer"
14
12
  require "logstash/shutdown_watcher"
15
13
  require "logstash/util/wrapped_synchronous_queue"
16
14
  require "logstash/pipeline_reporter"
@@ -22,7 +20,7 @@ require "logstash/output_delegator"
22
20
  require "logstash/filter_delegator"
23
21
 
24
22
  module LogStash; class Pipeline
25
- attr_reader :inputs,
23
+ attr_reader :inputs,
26
24
  :filters,
27
25
  :outputs,
28
26
  :worker_threads,
@@ -30,39 +28,25 @@ module LogStash; class Pipeline
30
28
  :events_filtered,
31
29
  :reporter,
32
30
  :pipeline_id,
33
- :metric,
34
31
  :logger,
35
32
  :started_at,
36
33
  :thread,
37
34
  :config_str,
38
- :original_settings
39
-
40
- DEFAULT_OUTPUT_WORKERS = 1
41
-
42
- DEFAULT_SETTINGS = {
43
- :default_pipeline_workers => LogStash::Config::CpuCoreStrategy.maximum,
44
- :pipeline_batch_size => 125,
45
- :pipeline_batch_delay => 5, # in milliseconds
46
- :flush_interval => 5, # in seconds
47
- :flush_timeout_interval => 60, # in seconds
48
- :debug_config => false,
49
- :allow_env => false
50
- }
35
+ :settings
36
+ attr_accessor :metric
37
+
51
38
  MAX_INFLIGHT_WARN_THRESHOLD = 10_000
52
39
 
53
40
  RELOAD_INCOMPATIBLE_PLUGINS = [
54
41
  "LogStash::Inputs::Stdin"
55
42
  ]
56
43
 
57
- def initialize(config_str, settings = {})
44
+ def initialize(config_str, settings = LogStash::SETTINGS)
58
45
  @config_str = config_str
59
- @original_settings = settings
60
46
  @logger = Cabin::Channel.get(LogStash)
61
- @pipeline_id = settings[:pipeline_id] || self.object_id
62
- @settings = DEFAULT_SETTINGS.clone
63
- settings.each {|setting, value| configure(setting, value) }
47
+ @settings = settings
48
+ @pipeline_id = @settings.get_value("pipeline.id") || self.object_id
64
49
  @reporter = LogStash::PipelineReporter.new(@logger, self)
65
- @allow_env = settings[:allow_env]
66
50
 
67
51
  @inputs = nil
68
52
  @filters = nil
@@ -70,15 +54,9 @@ module LogStash; class Pipeline
70
54
 
71
55
  @worker_threads = []
72
56
 
73
- # Metric object should be passed upstream, multiple pipeline share the same metric
74
- # and collector only the namespace will changes.
75
- # If no metric is given, we use a `NullMetric` for all internal calls.
76
- # We also do this to make the changes backward compatible with previous testing of the
77
- # pipeline.
78
- #
79
- # This need to be configured before we evaluate the code to make
80
- # sure the metric instance is correctly send to the plugin.
81
- @metric = settings.fetch(:metric, Instrument::NullMetric.new)
57
+ # This needs to be configured before we evaluate the code to make
58
+ # sure the metric instance is correctly send to the plugins to make the namespace scoping work
59
+ @metric = settings.get_value("metric.collect") ? Instrument::Metric.new : Instrument::NullMetric.new
82
60
 
83
61
  grammar = LogStashConfigParser.new
84
62
  @config = grammar.parse(config_str)
@@ -94,7 +72,7 @@ module LogStash; class Pipeline
94
72
  # The config code is hard to represent as a log message...
95
73
  # So just print it.
96
74
 
97
- if @settings[:debug_config] && logger.debug?
75
+ if @settings.get_value("config.debug") && logger.debug?
98
76
  logger.debug("Compiled pipeline code", :code => code)
99
77
  end
100
78
 
@@ -123,38 +101,29 @@ module LogStash; class Pipeline
123
101
  @ready.value
124
102
  end
125
103
 
126
- def configure(setting, value)
127
- @settings[setting] = value
128
- end
129
-
130
104
  def safe_pipeline_worker_count
131
- default = DEFAULT_SETTINGS[:default_pipeline_workers]
132
- thread_count = @settings[:pipeline_workers] #override from args "-w 8" or config
105
+ default = @settings.get_default("pipeline.workers")
106
+ pipeline_workers = @settings.get("pipeline.workers") #override from args "-w 8" or config
133
107
  safe_filters, unsafe_filters = @filters.partition(&:threadsafe?)
108
+ plugins = unsafe_filters.collect { |f| f.config_name }
134
109
 
135
- if unsafe_filters.any?
136
- plugins = unsafe_filters.collect { |f| f.config_name }
137
- case thread_count
138
- when nil
139
- # user did not specify a worker thread count
140
- # warn if the default is multiple
141
-
142
- if default > 1
143
- @logger.warn("Defaulting pipeline worker threads to 1 because there are some filters that might not work with multiple worker threads",
144
- :count_was => default, :filters => plugins)
145
- end
110
+ return pipeline_workers if unsafe_filters.empty?
146
111
 
147
- 1 # can't allow the default value to propagate if there are unsafe filters
148
- when 0, 1
149
- 1
150
- else
112
+ if @settings.set?("pipeline.workers")
113
+ if pipeline_workers > 1
151
114
  @logger.warn("Warning: Manual override - there are filters that might not work with multiple worker threads",
152
- :worker_threads => thread_count, :filters => plugins)
153
- thread_count # allow user to force this even if there are unsafe filters
115
+ :worker_threads => pipeline_workers, :filters => plugins)
154
116
  end
155
117
  else
156
- thread_count || default
118
+ # user did not specify a worker thread count
119
+ # warn if the default is multiple
120
+ if default > 1
121
+ @logger.warn("Defaulting pipeline worker threads to 1 because there are some filters that might not work with multiple worker threads",
122
+ :count_was => default, :filters => plugins)
123
+ return 1 # can't allow the default value to propagate if there are unsafe filters
124
+ end
157
125
  end
126
+ pipeline_workers
158
127
  end
159
128
 
160
129
  def filters?
@@ -164,9 +133,8 @@ module LogStash; class Pipeline
164
133
  def run
165
134
  @started_at = Time.now
166
135
 
167
- LogStash::Util.set_thread_name("[#{pipeline_id}]-pipeline-manager")
168
- @logger.terminal(LogStash::Util::DefaultsPrinter.print(@settings))
169
136
  @thread = Thread.current
137
+ LogStash::Util.set_thread_name("[#{pipeline_id}]-pipeline-manager")
170
138
 
171
139
  start_workers
172
140
 
@@ -217,15 +185,15 @@ module LogStash; class Pipeline
217
185
  @filters.each {|f| f.register }
218
186
 
219
187
  pipeline_workers = safe_pipeline_worker_count
220
- batch_size = @settings[:pipeline_batch_size]
221
- batch_delay = @settings[:pipeline_batch_delay]
188
+ batch_size = @settings.get("pipeline.batch.size")
189
+ batch_delay = @settings.get("pipeline.batch.delay")
222
190
  max_inflight = batch_size * pipeline_workers
223
191
  @logger.info("Starting pipeline",
224
- :id => self.pipeline_id,
225
- :pipeline_workers => pipeline_workers,
226
- :batch_size => batch_size,
227
- :batch_delay => batch_delay,
228
- :max_inflight => max_inflight)
192
+ "id" => self.pipeline_id,
193
+ "pipeline.workers" => pipeline_workers,
194
+ "pipeline.batch.size" => batch_size,
195
+ "pipeline.batch.delay" => batch_delay,
196
+ "pipeline.max_inflight" => max_inflight)
229
197
  if max_inflight > MAX_INFLIGHT_WARN_THRESHOLD
230
198
  @logger.warn "CAUTION: Recommended inflight events max exceeded! Logstash will run with up to #{max_inflight} events in memory in your current configuration. If your message sizes are large this may cause instability with the default heap size. Please consider setting a non-standard heap size, changing the batch size (currently #{batch_size}), or changing the number of pipeline workers (currently #{pipeline_workers})"
231
199
  end
@@ -438,7 +406,7 @@ module LogStash; class Pipeline
438
406
  def shutdown_workers
439
407
  # Each worker thread will receive this exactly once!
440
408
  @worker_threads.each do |t|
441
- @logger.debug("Pushing shutdown", :thread => t)
409
+ @logger.debug("Pushing shutdown", :thread => t.inspect)
442
410
  @input_queue.push(LogStash::SHUTDOWN)
443
411
  end
444
412
 
@@ -453,14 +421,13 @@ module LogStash; class Pipeline
453
421
 
454
422
  def plugin(plugin_type, name, *args)
455
423
  args << {} if args.empty?
456
- args.first.merge!(LogStash::Config::Mixin::ALLOW_ENV_FLAG => @allow_env)
457
424
 
458
425
  pipeline_scoped_metric = metric.namespace([:stats, :pipelines, pipeline_id.to_s.to_sym, :plugins])
459
426
 
460
427
  klass = LogStash::Plugin.lookup(plugin_type, name)
461
428
 
462
429
  if plugin_type == "output"
463
- LogStash::OutputDelegator.new(@logger, klass, DEFAULT_OUTPUT_WORKERS, pipeline_scoped_metric.namespace(:outputs), *args)
430
+ LogStash::OutputDelegator.new(@logger, klass, @settings.get("pipeline.output.workers"), pipeline_scoped_metric.namespace(:outputs), *args)
464
431
  elsif plugin_type == "filter"
465
432
  LogStash::FilterDelegator.new(@logger, klass, pipeline_scoped_metric.namespace(:filters), *args)
466
433
  else