logstash-core 5.0.0.alpha3.snapshot2-java → 5.0.0.alpha3.snapshot4-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.
- checksums.yaml +4 -4
- data/lib/logstash-core/version.rb +1 -1
- data/lib/logstash/agent.rb +49 -31
- data/lib/logstash/api/init.ru +3 -3
- data/lib/logstash/api/lib/app/service.rb +1 -1
- data/lib/logstash/config/config_ast.rb +23 -18
- data/lib/logstash/config/loader.rb +4 -4
- data/lib/logstash/config/mixin.rb +10 -21
- data/lib/logstash/environment.rb +30 -0
- data/lib/logstash/filters/base.rb +2 -2
- data/lib/logstash/inputs/base.rb +2 -2
- data/lib/logstash/instrument/collector.rb +1 -1
- data/lib/logstash/logging/json.rb +21 -0
- data/lib/logstash/output_delegator.rb +2 -2
- data/lib/logstash/patches/clamp.rb +69 -0
- data/lib/logstash/pipeline.rb +37 -62
- data/lib/logstash/plugin.rb +1 -1
- data/lib/logstash/runner.rb +155 -146
- data/lib/logstash/settings.rb +267 -0
- data/lib/logstash/util/decorators.rb +6 -6
- data/lib/logstash/util/java_version.rb +1 -10
- data/lib/logstash/util/worker_threads_default_printer.rb +2 -2
- data/lib/logstash/version.rb +1 -1
- data/locales/en.yml +17 -20
- data/logstash-core.gemspec +1 -1
- data/spec/api/spec_helper.rb +15 -16
- data/spec/conditionals_spec.rb +113 -113
- data/spec/logstash/agent_spec.rb +77 -68
- data/spec/logstash/config/config_ast_spec.rb +4 -2
- data/spec/logstash/config/mixin_spec.rb +33 -7
- data/spec/logstash/filters/base_spec.rb +16 -16
- data/spec/logstash/inputs/base_spec.rb +8 -8
- data/spec/logstash/output_delegator_spec.rb +2 -0
- data/spec/logstash/pipeline_spec.rb +60 -26
- data/spec/logstash/plugin_spec.rb +2 -2
- data/spec/logstash/runner_spec.rb +112 -25
- data/spec/logstash/setting_spec.rb +130 -0
- data/spec/logstash/settings_spec.rb +62 -0
- metadata +11 -9
- data/lib/logstash/util/defaults_printer.rb +0 -31
- data/spec/logstash/util/defaults_printer_spec.rb +0 -50
- data/spec/logstash/util/worker_threads_default_printer_spec.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e159407a5799becbef3c1eed0aa42ac18038ce20
|
4
|
+
data.tar.gz: 0308d3dc734c7615f12e194b49b4b86d6d69c2d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172062b5b43a2738e5350605b036dddcbe90e07741a53b385f48f85225bc59250ec5f6e324fb63600f7a21c3a99ba955e85160027aa5702ac566c4aff28006e3
|
7
|
+
data.tar.gz: 573884287eeda4cb355655cfad1398a8f02238e7c6860a6f66e53f5ac5f5150cb33601a6ffb716845b7c1e4b3e69cb078330fa83aa76e7897c46014599919b66
|
data/lib/logstash/agent.rb
CHANGED
@@ -20,7 +20,8 @@ LogStash::Environment.load_locale!
|
|
20
20
|
class LogStash::Agent
|
21
21
|
STARTED_AT = Time.now.freeze
|
22
22
|
|
23
|
-
attr_reader :metric, :node_name, :pipelines, :
|
23
|
+
attr_reader :metric, :node_name, :pipelines, :settings
|
24
|
+
attr_accessor :logger
|
24
25
|
|
25
26
|
# initialize method for LogStash::Agent
|
26
27
|
# @param params [Hash] potential parameters are:
|
@@ -28,21 +29,23 @@ class LogStash::Agent
|
|
28
29
|
# :auto_reload [Boolean] - enable reloading of pipelines
|
29
30
|
# :reload_interval [Integer] - reload pipelines every X seconds
|
30
31
|
# :logger [Cabin::Channel] - logger instance
|
31
|
-
def initialize(
|
32
|
-
@
|
33
|
-
@
|
32
|
+
def initialize(settings = LogStash::SETTINGS)
|
33
|
+
@settings = settings
|
34
|
+
@logger = Cabin::Channel.get(LogStash)
|
35
|
+
@auto_reload = setting("config.reload.automatic")
|
34
36
|
|
35
37
|
@pipelines = {}
|
36
|
-
@node_name =
|
37
|
-
@
|
38
|
-
@
|
38
|
+
@node_name = setting("node.name")
|
39
|
+
@http_host = setting("http.host")
|
40
|
+
@http_port = setting("http.port")
|
39
41
|
|
40
|
-
@config_loader = LogStash::Config::Loader.new(@logger
|
41
|
-
@reload_interval =
|
42
|
+
@config_loader = LogStash::Config::Loader.new(@logger)
|
43
|
+
@reload_interval = setting("config.reload.interval")
|
42
44
|
@upgrade_mutex = Mutex.new
|
43
45
|
|
44
|
-
@collect_metric =
|
45
|
-
|
46
|
+
@collect_metric = setting("metric.collect")
|
47
|
+
@metric = create_metric_collector
|
48
|
+
@periodic_pollers = LogStash::Instrument::PeriodicPollers.new(metric)
|
46
49
|
end
|
47
50
|
|
48
51
|
def execute
|
@@ -74,9 +77,13 @@ class LogStash::Agent
|
|
74
77
|
# @param pipeline_id [String] pipeline string identifier
|
75
78
|
# @param settings [Hash] settings that will be passed when creating the pipeline.
|
76
79
|
# keys should be symbols such as :pipeline_workers and :pipeline_batch_delay
|
77
|
-
def register_pipeline(pipeline_id, settings)
|
78
|
-
|
80
|
+
def register_pipeline(pipeline_id, settings = @settings)
|
81
|
+
pipeline_settings = settings.clone
|
82
|
+
pipeline_settings.set("pipeline.id", pipeline_id)
|
83
|
+
|
84
|
+
pipeline = create_pipeline(pipeline_settings)
|
79
85
|
return unless pipeline.is_a?(LogStash::Pipeline)
|
86
|
+
pipeline.metric = @metric
|
80
87
|
if @auto_reload && pipeline.non_reloadable_plugins.any?
|
81
88
|
@logger.error(I18n.t("logstash.agent.non_reloadable_config_register"),
|
82
89
|
:pipeline_id => pipeline_id,
|
@@ -123,7 +130,7 @@ class LogStash::Agent
|
|
123
130
|
|
124
131
|
private
|
125
132
|
def start_webserver
|
126
|
-
options = {:http_host => @
|
133
|
+
options = {:http_host => @http_host, :http_port => @http_port }
|
127
134
|
@webserver = LogStash::WebServer.new(@logger, options)
|
128
135
|
Thread.new(@webserver) do |webserver|
|
129
136
|
LogStash::Util.set_thread_name("Api Webserver")
|
@@ -149,28 +156,29 @@ class LogStash::Agent
|
|
149
156
|
end
|
150
157
|
end
|
151
158
|
|
152
|
-
def
|
159
|
+
def create_metric_collector
|
153
160
|
if collect_metrics?
|
154
161
|
@logger.debug("Agent: Configuring metric collection")
|
155
162
|
LogStash::Instrument::Collector.instance.agent = self
|
156
|
-
|
163
|
+
LogStash::Instrument::Metric.new
|
157
164
|
else
|
158
|
-
|
165
|
+
LogStash::Instrument::NullMetric.new
|
159
166
|
end
|
160
|
-
|
161
|
-
@periodic_pollers = LogStash::Instrument::PeriodicPollers.new(metric)
|
162
167
|
end
|
163
168
|
|
164
169
|
def collect_metrics?
|
165
170
|
@collect_metric
|
166
171
|
end
|
167
172
|
|
168
|
-
def create_pipeline(settings)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
173
|
+
def create_pipeline(settings, config=nil)
|
174
|
+
|
175
|
+
if config.nil?
|
176
|
+
begin
|
177
|
+
config = fetch_config(settings)
|
178
|
+
rescue => e
|
179
|
+
@logger.error("failed to fetch pipeline configuration", :message => e.message)
|
180
|
+
return
|
181
|
+
end
|
174
182
|
end
|
175
183
|
|
176
184
|
begin
|
@@ -182,23 +190,29 @@ class LogStash::Agent
|
|
182
190
|
end
|
183
191
|
|
184
192
|
def fetch_config(settings)
|
185
|
-
@config_loader.format_config(settings
|
193
|
+
@config_loader.format_config(settings.get("path.config"), settings.get("config.string"))
|
186
194
|
end
|
187
195
|
|
188
196
|
# since this method modifies the @pipelines hash it is
|
189
197
|
# wrapped in @upgrade_mutex in the parent call `reload_state!`
|
190
198
|
def reload_pipeline!(id)
|
191
199
|
old_pipeline = @pipelines[id]
|
192
|
-
|
200
|
+
new_config = fetch_config(old_pipeline.settings)
|
201
|
+
if old_pipeline.config_str == new_config
|
202
|
+
@logger.debug("no configuration change for pipeline",
|
203
|
+
:pipeline => id, :config => new_config)
|
204
|
+
return
|
205
|
+
end
|
206
|
+
|
207
|
+
new_pipeline = create_pipeline(old_pipeline.settings, new_config)
|
208
|
+
|
193
209
|
return if new_pipeline.nil?
|
194
210
|
|
195
|
-
if
|
196
|
-
@logger.debug("no configuration change for pipeline",
|
197
|
-
:pipeline => id, :config => old_pipeline.config_str)
|
198
|
-
elsif new_pipeline.non_reloadable_plugins.any?
|
211
|
+
if new_pipeline.non_reloadable_plugins.any?
|
199
212
|
@logger.error(I18n.t("logstash.agent.non_reloadable_config_reload"),
|
200
213
|
:pipeline_id => id,
|
201
214
|
:plugins => new_pipeline.non_reloadable_plugins.map(&:class))
|
215
|
+
return
|
202
216
|
else
|
203
217
|
@logger.warn("fetched new config for pipeline. upgrading..",
|
204
218
|
:pipeline => id, :config => new_pipeline.config_str)
|
@@ -262,4 +276,8 @@ class LogStash::Agent
|
|
262
276
|
def reset_collector
|
263
277
|
LogStash::Instrument::Collector.instance.clear
|
264
278
|
end
|
279
|
+
|
280
|
+
def setting(key)
|
281
|
+
@settings.get(key)
|
282
|
+
end
|
265
283
|
end # class LogStash::Agent
|
data/lib/logstash/api/init.ru
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift File.join(
|
3
|
-
Dir.glob('lib/**').each{ |d| $LOAD_PATH.unshift(File.join(
|
1
|
+
api_root = File.expand_path(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift File.join(api_root, 'lib')
|
3
|
+
Dir.glob('lib/**').each{ |d| $LOAD_PATH.unshift(File.join(api_root, d)) }
|
4
4
|
|
5
5
|
require 'sinatra'
|
6
6
|
require 'app/root'
|
@@ -28,7 +28,7 @@ class LogStash::Api::Service
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def update(snapshot)
|
31
|
-
logger.debug("[api-service] snapshot received", :
|
31
|
+
logger.debug("[api-service] snapshot received", :snapshot_time => snapshot.created_at) if logger.debug?
|
32
32
|
if @snapshot_rotation_mutex.try_lock
|
33
33
|
@snapshot = snapshot
|
34
34
|
@snapshot_rotation_mutex.unlock
|
@@ -94,6 +94,7 @@ module LogStash; module Config; module AST
|
|
94
94
|
@outputs = []
|
95
95
|
@periodic_flushers = []
|
96
96
|
@shutdown_flushers = []
|
97
|
+
@generated_objects = {}
|
97
98
|
CODE
|
98
99
|
|
99
100
|
sections = recursive_select(LogStash::Config::AST::PluginSection)
|
@@ -137,7 +138,10 @@ module LogStash; module Config; module AST
|
|
137
138
|
class PluginSection < Node
|
138
139
|
# Global plugin numbering for the janky instance variable naming we use
|
139
140
|
# like @filter_<name>_1
|
140
|
-
|
141
|
+
def initialize(*args)
|
142
|
+
super(*args)
|
143
|
+
@i = 0
|
144
|
+
end
|
141
145
|
|
142
146
|
# Generate ruby code to initialize all the plugins.
|
143
147
|
def compile_initializer
|
@@ -147,31 +151,31 @@ module LogStash; module Config; module AST
|
|
147
151
|
|
148
152
|
|
149
153
|
code << <<-CODE
|
150
|
-
|
151
|
-
@#{plugin.plugin_type}s <<
|
154
|
+
@generated_objects[:#{name}] = #{plugin.compile_initializer}
|
155
|
+
@#{plugin.plugin_type}s << @generated_objects[:#{name}]
|
152
156
|
CODE
|
153
157
|
|
154
158
|
# The flush method for this filter.
|
155
159
|
if plugin.plugin_type == "filter"
|
156
160
|
|
157
161
|
code << <<-CODE
|
158
|
-
|
159
|
-
@logger.debug? && @logger.debug(\"Flushing\", :plugin =>
|
162
|
+
@generated_objects[:#{name}_flush] = lambda do |options, &block|
|
163
|
+
@logger.debug? && @logger.debug(\"Flushing\", :plugin => @generated_objects[:#{name}])
|
160
164
|
|
161
|
-
events =
|
165
|
+
events = @generated_objects[:#{name}].flush(options)
|
162
166
|
|
163
167
|
return if events.nil? || events.empty?
|
164
168
|
|
165
|
-
@logger.debug? && @logger.debug(\"Flushing\", :plugin =>
|
169
|
+
@logger.debug? && @logger.debug(\"Flushing\", :plugin => @generated_objects[:#{name}], :events => events)
|
166
170
|
|
167
171
|
#{plugin.compile_starting_here.gsub(/^/, " ")}
|
168
172
|
|
169
173
|
events.each{|e| block.call(e)}
|
170
174
|
end
|
171
175
|
|
172
|
-
if
|
173
|
-
@periodic_flushers <<
|
174
|
-
@shutdown_flushers <<
|
176
|
+
if @generated_objects[:#{name}].respond_to?(:flush)
|
177
|
+
@periodic_flushers << @generated_objects[:#{name}_flush] if @generated_objects[:#{name}].periodic_flush
|
178
|
+
@shutdown_flushers << @generated_objects[:#{name}_flush]
|
175
179
|
end
|
176
180
|
CODE
|
177
181
|
|
@@ -192,9 +196,10 @@ module LogStash; module Config; module AST
|
|
192
196
|
|
193
197
|
plugins.each do |plugin|
|
194
198
|
# Unique number for every plugin.
|
195
|
-
|
199
|
+
@i += 1
|
196
200
|
# store things as ivars, like @filter_grok_3
|
197
|
-
var = "
|
201
|
+
var = :"#{plugin.plugin_type}_#{plugin.plugin_name}_#{@i}"
|
202
|
+
# puts("var=#{var.inspect}")
|
198
203
|
@variables[plugin] = var
|
199
204
|
end
|
200
205
|
return @variables
|
@@ -236,13 +241,13 @@ module LogStash; module Config; module AST
|
|
236
241
|
def compile
|
237
242
|
case plugin_type
|
238
243
|
when "input"
|
239
|
-
return "start_input(
|
244
|
+
return "start_input(@generated_objects[:#{variable_name}])"
|
240
245
|
when "filter"
|
241
246
|
return <<-CODE
|
242
|
-
events =
|
247
|
+
events = @generated_objects[:#{variable_name}].multi_filter(events)
|
243
248
|
CODE
|
244
249
|
when "output"
|
245
|
-
return "targeted_outputs <<
|
250
|
+
return "targeted_outputs << @generated_objects[:#{variable_name}]\n"
|
246
251
|
when "codec"
|
247
252
|
settings = attributes.recursive_select(Attribute).collect(&:compile).reject(&:empty?)
|
248
253
|
attributes_code = "LogStash::Util.hash_merge_many(#{settings.map { |c| "{ #{c} }" }.join(", ")})"
|
@@ -391,7 +396,7 @@ module LogStash; module Config; module AST
|
|
391
396
|
if type == "filter"
|
392
397
|
i = LogStash::Config::AST.defered_conditionals_index += 1
|
393
398
|
source = <<-CODE
|
394
|
-
|
399
|
+
@generated_objects[:cond_func_#{i}] = lambda do |input_events|
|
395
400
|
result = []
|
396
401
|
input_events.each do |event|
|
397
402
|
events = [event]
|
@@ -405,7 +410,7 @@ module LogStash; module Config; module AST
|
|
405
410
|
LogStash::Config::AST.defered_conditionals << source
|
406
411
|
|
407
412
|
<<-CODE
|
408
|
-
events = cond_func_#{i}(events)
|
413
|
+
events = @generated_objects[:cond_func_#{i}].call(events)
|
409
414
|
CODE
|
410
415
|
else # Output
|
411
416
|
<<-CODE
|
@@ -512,7 +517,7 @@ module LogStash; module Config; module AST
|
|
512
517
|
end
|
513
518
|
class Selector < RValue
|
514
519
|
def compile
|
515
|
-
return "event
|
520
|
+
return "event.get(#{text_value.inspect})"
|
516
521
|
end
|
517
522
|
end
|
518
523
|
class SelectorElement < Node; end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require "logstash/config/defaults"
|
2
2
|
|
3
3
|
module LogStash; module Config; class Loader
|
4
|
-
def initialize(logger
|
4
|
+
def initialize(logger)
|
5
5
|
@logger = logger
|
6
|
-
@
|
6
|
+
@config_debug = LogStash::SETTINGS.get_value("config.debug")
|
7
7
|
end
|
8
8
|
|
9
9
|
def format_config(config_path, config_string)
|
@@ -70,7 +70,7 @@ module LogStash; module Config; class Loader
|
|
70
70
|
encoding_issue_files << file
|
71
71
|
end
|
72
72
|
config << cfg + "\n"
|
73
|
-
if @
|
73
|
+
if @config_debug
|
74
74
|
@logger.debug? && @logger.debug("\nThe following is the content of a file", :config_file => file.to_s)
|
75
75
|
@logger.debug? && @logger.debug("\n" + cfg + "\n\n")
|
76
76
|
end
|
@@ -78,7 +78,7 @@ module LogStash; module Config; class Loader
|
|
78
78
|
if encoding_issue_files.any?
|
79
79
|
fail("The following config files contains non-ascii characters but are not UTF-8 encoded #{encoding_issue_files}")
|
80
80
|
end
|
81
|
-
if @
|
81
|
+
if @config_debug
|
82
82
|
@logger.debug? && @logger.debug("\nThe following is the merged configuration")
|
83
83
|
@logger.debug? && @logger.debug("\n" + config + "\n\n")
|
84
84
|
end
|
@@ -39,7 +39,6 @@ module LogStash::Config::Mixin
|
|
39
39
|
PLUGIN_VERSION_1_0_0 = LogStash::Util::PluginVersion.new(1, 0, 0)
|
40
40
|
PLUGIN_VERSION_0_9_0 = LogStash::Util::PluginVersion.new(0, 9, 0)
|
41
41
|
|
42
|
-
ALLOW_ENV_FLAG = "__ALLOW_ENV__"
|
43
42
|
ENV_PLACEHOLDER_REGEX = /\$\{(?<name>\w+)(\:(?<default>[^}]*))?\}/
|
44
43
|
|
45
44
|
# This method is called when someone does 'include LogStash::Config'
|
@@ -49,14 +48,6 @@ module LogStash::Config::Mixin
|
|
49
48
|
end
|
50
49
|
|
51
50
|
def config_init(params)
|
52
|
-
# HACK(talevy): https://github.com/elastic/logstash/issues/4958
|
53
|
-
# Currently, the regular plugins params argument is hijacked
|
54
|
-
# to pass along the `allow_env` configuration variable. This was done as to
|
55
|
-
# not change the method signature of Plugin. This also makes it difficul to
|
56
|
-
# reason about at the same time. ALLOW_ENV_FLAG is a special param that users
|
57
|
-
# are now forbidden to set in their configuration definitions.
|
58
|
-
allow_env = params.delete(LogStash::Config::Mixin::ALLOW_ENV_FLAG) { false }
|
59
|
-
|
60
51
|
# Validation will modify the values inside params if necessary.
|
61
52
|
# For example: converting a string to a number, etc.
|
62
53
|
|
@@ -112,20 +103,18 @@ module LogStash::Config::Mixin
|
|
112
103
|
end
|
113
104
|
|
114
105
|
# Resolve environment variables references
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
value.
|
119
|
-
|
106
|
+
params.each do |name, value|
|
107
|
+
if (value.is_a?(Hash))
|
108
|
+
value.each do |valueHashKey, valueHashValue|
|
109
|
+
value[valueHashKey.to_s] = replace_env_placeholders(valueHashValue)
|
110
|
+
end
|
111
|
+
else
|
112
|
+
if (value.is_a?(Array))
|
113
|
+
value.each_index do |valueArrayIndex|
|
114
|
+
value[valueArrayIndex] = replace_env_placeholders(value[valueArrayIndex])
|
120
115
|
end
|
121
116
|
else
|
122
|
-
|
123
|
-
value.each_index do |valueArrayIndex|
|
124
|
-
value[valueArrayIndex] = replace_env_placeholders(value[valueArrayIndex])
|
125
|
-
end
|
126
|
-
else
|
127
|
-
params[name.to_s] = replace_env_placeholders(value)
|
128
|
-
end
|
117
|
+
params[name.to_s] = replace_env_placeholders(value)
|
129
118
|
end
|
130
119
|
end
|
131
120
|
end
|
data/lib/logstash/environment.rb
CHANGED
@@ -1,7 +1,37 @@
|
|
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("path.settings", ::File.join(Environment::LOGSTASH_HOME, "config")),
|
17
|
+
Setting::String.new("pipeline.id", "main"),
|
18
|
+
Setting::Numeric.new("pipeline.workers", LogStash::Config::CpuCoreStrategy.maximum),
|
19
|
+
Setting::Numeric.new("pipeline.output.workers", 1),
|
20
|
+
Setting::Numeric.new("pipeline.batch.size", 125),
|
21
|
+
Setting::Numeric.new("pipeline.batch.delay", 5), # in milliseconds
|
22
|
+
Setting::Boolean.new("pipeline.unsafe_shutdown", false),
|
23
|
+
Setting.new("path.plugins", Array, []),
|
24
|
+
Setting::String.new("interactive", nil, false),
|
25
|
+
Setting::Boolean.new("config.debug", false),
|
26
|
+
Setting::String.new("log.level", "warn", true, ["quiet", "verbose", "warn", "debug"]),
|
27
|
+
Setting::Boolean.new("version", false),
|
28
|
+
Setting::Boolean.new("help", false),
|
29
|
+
Setting::String.new("path.log", nil, false),
|
30
|
+
Setting::String.new("log.format", "plain", true, ["json", "plain"]),
|
31
|
+
Setting::String.new("http.host", "127.0.0.1"),
|
32
|
+
Setting::Port.new("http.port", 9600),
|
33
|
+
].each {|setting| SETTINGS.register(setting) }
|
34
|
+
|
5
35
|
module Environment
|
6
36
|
extend self
|
7
37
|
|
@@ -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
|
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
|
195
|
+
event.set("tags", tags)
|
196
196
|
end
|
197
197
|
end # def filter_matched
|
198
198
|
|
data/lib/logstash/inputs/base.rb
CHANGED
@@ -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
|
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}")
|