logstash-core 6.8.20-java → 7.0.0.alpha1-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 +69 -85
- data/lib/logstash/api/modules/stats.rb +1 -1
- data/lib/logstash/compiler/lscl.rb +7 -7
- data/lib/logstash/config/config_ast.rb +1 -1
- data/lib/logstash/config/mixin.rb +1 -1
- data/lib/logstash/config/modules_common.rb +3 -3
- data/lib/logstash/dependency_report.rb +1 -2
- data/lib/logstash/environment.rb +4 -9
- data/lib/logstash/event.rb +1 -24
- data/lib/logstash/filter_delegator.rb +69 -2
- data/lib/logstash/filters/base.rb +2 -0
- data/lib/logstash/instrument/metric_store.rb +1 -1
- data/lib/logstash/instrument/periodic_poller/dlq.rb +7 -5
- data/lib/logstash/instrument/periodic_poller/jvm.rb +3 -3
- data/lib/logstash/instrument/periodic_poller/pq.rb +8 -6
- data/lib/logstash/instrument/periodic_pollers.rb +3 -3
- data/lib/logstash/java_pipeline.rb +11 -38
- data/lib/logstash/modules/kibana_config.rb +1 -1
- data/lib/logstash/modules/logstash_config.rb +1 -1
- data/lib/logstash/patches/resolv.rb +32 -17
- data/lib/logstash/pipeline.rb +11 -28
- data/lib/logstash/pipeline_action/base.rb +1 -1
- data/lib/logstash/pipeline_action/create.rb +13 -7
- data/lib/logstash/pipeline_action/reload.rb +12 -35
- data/lib/logstash/pipeline_action/stop.rb +6 -4
- data/lib/logstash/pipeline_settings.rb +1 -2
- data/lib/logstash/plugins/registry.rb +2 -5
- data/lib/logstash/runner.rb +0 -24
- data/lib/logstash/settings.rb +5 -5
- data/lib/logstash/state_resolver.rb +5 -5
- data/lib/logstash/util/duration_formatter.rb +1 -1
- data/lib/logstash/util/safe_uri.rb +0 -1
- data/lib/logstash/util/substitution_variables.rb +1 -22
- data/lib/logstash/util/thread_dump.rb +1 -1
- data/lib/logstash/util.rb +1 -11
- data/lib/logstash-core/version.rb +3 -1
- data/locales/en.yml +7 -16
- data/logstash-core.gemspec +11 -2
- data/spec/logstash/acked_queue_concurrent_stress_spec.rb +2 -2
- data/spec/logstash/agent/converge_spec.rb +31 -25
- data/spec/logstash/agent/metrics_spec.rb +1 -1
- data/spec/logstash/agent_spec.rb +7 -6
- data/spec/logstash/compiler/compiler_spec.rb +0 -28
- data/spec/logstash/config/config_ast_spec.rb +0 -15
- data/spec/logstash/config/mixin_spec.rb +2 -3
- data/spec/logstash/converge_result_spec.rb +1 -1
- data/spec/logstash/environment_spec.rb +4 -4
- data/spec/logstash/event_spec.rb +2 -10
- data/spec/logstash/filter_delegator_spec.rb +12 -2
- data/spec/logstash/filters/base_spec.rb +9 -45
- data/spec/logstash/instrument/periodic_poller/cgroup_spec.rb +2 -0
- data/spec/logstash/instrument/wrapped_write_client_spec.rb +1 -1
- data/spec/logstash/java_filter_delegator_spec.rb +11 -1
- data/spec/logstash/legacy_ruby_event_spec.rb +5 -6
- data/spec/logstash/patches_spec.rb +3 -1
- data/spec/logstash/pipeline_action/create_spec.rb +8 -14
- data/spec/logstash/pipeline_action/reload_spec.rb +9 -16
- data/spec/logstash/pipeline_action/stop_spec.rb +3 -4
- data/spec/logstash/queue_factory_spec.rb +1 -2
- data/spec/logstash/runner_spec.rb +0 -2
- data/spec/logstash/settings/array_coercible_spec.rb +1 -1
- data/spec/logstash/settings/bytes_spec.rb +2 -2
- data/spec/logstash/settings/port_range_spec.rb +1 -1
- data/spec/logstash/settings_spec.rb +0 -10
- data/spec/logstash/state_resolver_spec.rb +22 -26
- data/spec/logstash/util/safe_uri_spec.rb +0 -40
- data/spec/logstash/util/secretstore_spec.rb +1 -1
- data/spec/logstash/util/time_value_spec.rb +1 -1
- data/spec/logstash/util/wrapped_acked_queue_spec.rb +1 -1
- data/spec/logstash/webserver_spec.rb +5 -9
- data/spec/support/matchers.rb +19 -25
- data/spec/support/shared_contexts.rb +3 -3
- data/versions-gem-copy.yml +9 -9
- metadata +31 -44
- data/lib/logstash/patches/resolv_9270.rb +0 -2903
- data/lib/logstash/pipelines_registry.rb +0 -166
- data/lib/logstash/util/lazy_singleton.rb +0 -33
- data/spec/logstash/jruby_version_spec.rb +0 -15
- data/spec/logstash/pipelines_registry_spec.rb +0 -220
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aac6580e3fcdb7a4ef97667263de8081ef5f747948508322dc44dcf58f649102
|
4
|
+
data.tar.gz: 62fe96390ead958576494f6507200be79183eb4d36daf3724b9b3f9116f686ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 551463904e10b3d091962829e5f55c6a32435d6f39799d725a72c8b5fa7bf5051abc4cfdd2ab6e8b509a70d28b33e9cce1deedaae16e70fefd49fb7100a61b07
|
7
|
+
data.tar.gz: '08c65c30b5223731ff293615a5c321262eb2e93d6fa896d25b064ccc52de2e2b9b877e01976b156919f3e0bf4852f3c3ae261f40375332217ad246ebbb982d85'
|
data/lib/logstash/agent.rb
CHANGED
@@ -8,7 +8,6 @@ require "logstash/webserver"
|
|
8
8
|
require "logstash/config/source_loader"
|
9
9
|
require "logstash/pipeline_action"
|
10
10
|
require "logstash/state_resolver"
|
11
|
-
require "logstash/pipelines_registry"
|
12
11
|
require "stud/trap"
|
13
12
|
require "uri"
|
14
13
|
require "socket"
|
@@ -20,7 +19,7 @@ class LogStash::Agent
|
|
20
19
|
include LogStash::Util::Loggable
|
21
20
|
STARTED_AT = Time.now.freeze
|
22
21
|
|
23
|
-
attr_reader :metric, :name, :settings, :dispatcher, :ephemeral_id, :pipeline_bus
|
22
|
+
attr_reader :metric, :name, :settings, :webserver, :dispatcher, :ephemeral_id, :pipelines, :pipeline_bus
|
24
23
|
attr_accessor :logger
|
25
24
|
|
26
25
|
# initialize method for LogStash::Agent
|
@@ -37,14 +36,11 @@ class LogStash::Agent
|
|
37
36
|
# Mutex to synchonize in the exclusive method
|
38
37
|
# Initial usage for the Ruby pipeline initialization which is not thread safe
|
39
38
|
@exclusive_lock = Mutex.new
|
40
|
-
@webserver_control_lock = Mutex.new
|
41
|
-
|
42
|
-
@convergence_lock = Mutex.new
|
43
39
|
|
44
40
|
# Special bus object for inter-pipelines communications. Used by the `pipeline` input/output
|
45
41
|
@pipeline_bus = org.logstash.plugins.pipeline.PipelineBus.new
|
46
42
|
|
47
|
-
@
|
43
|
+
@pipelines = java.util.concurrent.ConcurrentHashMap.new();
|
48
44
|
|
49
45
|
@name = setting("node.name")
|
50
46
|
@http_host = setting("http.host")
|
@@ -54,14 +50,10 @@ class LogStash::Agent
|
|
54
50
|
id
|
55
51
|
|
56
52
|
# Set the global FieldReference parsing mode
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
else fail('Unsupported FieldReference parsing mode')
|
62
|
-
end
|
63
|
-
logger.debug("Setting global FieldReference parsing mode: #{parsing_mode}")
|
64
|
-
org.logstash.FieldReference::set_parsing_mode(parsing_mode)
|
53
|
+
if @settings.set?('config.field_reference.parser')
|
54
|
+
# TODO: i18n
|
55
|
+
logger.warn("deprecated setting `config.field_reference.parser` set; field reference parsing is strict by default")
|
56
|
+
end
|
65
57
|
|
66
58
|
# This is for backward compatibility in the tests
|
67
59
|
if source_loader.nil?
|
@@ -122,17 +114,14 @@ class LogStash::Agent
|
|
122
114
|
converge_state_and_update unless stopped?
|
123
115
|
end
|
124
116
|
else
|
125
|
-
|
126
|
-
return 1 if @pipelines_registry.empty?
|
117
|
+
return 1 if clean_state?
|
127
118
|
|
128
119
|
while !Stud.stop?
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
sleep(0.5)
|
120
|
+
if clean_state? || running_user_defined_pipelines?
|
121
|
+
sleep(0.5)
|
122
|
+
else
|
123
|
+
break
|
124
|
+
end
|
136
125
|
end
|
137
126
|
end
|
138
127
|
|
@@ -146,11 +135,11 @@ class LogStash::Agent
|
|
146
135
|
end
|
147
136
|
|
148
137
|
def running?
|
149
|
-
@running.
|
138
|
+
@running.value
|
150
139
|
end
|
151
140
|
|
152
141
|
def stopped?
|
153
|
-
|
142
|
+
!@running.value
|
154
143
|
end
|
155
144
|
|
156
145
|
def converge_state_and_update
|
@@ -165,7 +154,12 @@ class LogStash::Agent
|
|
165
154
|
end
|
166
155
|
end
|
167
156
|
|
168
|
-
|
157
|
+
# We Lock any access on the pipelines, since the actions will modify the
|
158
|
+
# content of it.
|
159
|
+
converge_result = nil
|
160
|
+
|
161
|
+
pipeline_actions = resolve_actions(results.response)
|
162
|
+
converge_result = converge_state(pipeline_actions)
|
169
163
|
update_metrics(converge_result)
|
170
164
|
|
171
165
|
logger.info(
|
@@ -184,7 +178,7 @@ class LogStash::Agent
|
|
184
178
|
|
185
179
|
# Calculate the Logstash uptime in milliseconds
|
186
180
|
#
|
187
|
-
# @return [
|
181
|
+
# @return [Fixnum] Uptime in milliseconds
|
188
182
|
def uptime
|
189
183
|
((Time.now.to_f - STARTED_AT.to_f) * 1000.0).to_i
|
190
184
|
end
|
@@ -239,48 +233,43 @@ class LogStash::Agent
|
|
239
233
|
@id_path ||= ::File.join(settings.get("path.data"), "uuid")
|
240
234
|
end
|
241
235
|
|
242
|
-
#
|
243
|
-
# Backward compatibility proxies to the PipelineRegistry
|
244
|
-
#
|
245
|
-
|
246
236
|
def get_pipeline(pipeline_id)
|
247
|
-
|
237
|
+
pipelines.get(pipeline_id)
|
248
238
|
end
|
249
239
|
|
250
240
|
def pipelines_count
|
251
|
-
|
241
|
+
pipelines.size
|
252
242
|
end
|
253
243
|
|
254
244
|
def running_pipelines
|
255
|
-
|
256
|
-
|
245
|
+
pipelines.select {|id,pipeline| running_pipeline?(id) }
|
246
|
+
end
|
257
247
|
|
258
248
|
def non_running_pipelines
|
259
|
-
|
249
|
+
pipelines.select {|id,pipeline| !running_pipeline?(id) }
|
260
250
|
end
|
261
251
|
|
262
252
|
def running_pipelines?
|
263
|
-
|
253
|
+
running_pipelines_count > 0
|
264
254
|
end
|
265
255
|
|
266
256
|
def running_pipelines_count
|
267
|
-
|
257
|
+
running_pipelines.size
|
268
258
|
end
|
269
259
|
|
270
260
|
def running_user_defined_pipelines?
|
271
|
-
|
261
|
+
!running_user_defined_pipelines.empty?
|
272
262
|
end
|
273
263
|
|
274
264
|
def running_user_defined_pipelines
|
275
|
-
|
265
|
+
pipelines.select {|id, pipeline| running_pipeline?(id) && !pipeline.system? }
|
276
266
|
end
|
277
267
|
|
278
|
-
def
|
279
|
-
|
268
|
+
def with_running_user_defined_pipelines
|
269
|
+
yield running_user_defined_pipelines
|
280
270
|
end
|
281
271
|
|
282
272
|
private
|
283
|
-
|
284
273
|
def transition_to_stopped
|
285
274
|
@running.make_false
|
286
275
|
end
|
@@ -289,15 +278,6 @@ class LogStash::Agent
|
|
289
278
|
@running.make_true
|
290
279
|
end
|
291
280
|
|
292
|
-
# @param pipeline_configs [Array<Config::PipelineConfig>]
|
293
|
-
# @return [ConvergeResult]
|
294
|
-
def resolve_actions_and_converge_state(pipeline_configs)
|
295
|
-
@convergence_lock.synchronize do
|
296
|
-
pipeline_actions = resolve_actions(pipeline_configs)
|
297
|
-
converge_state(pipeline_actions)
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
281
|
# We depends on a series of task derived from the internal state and what
|
302
282
|
# need to be run, theses actions are applied to the current pipelines to converge to
|
303
283
|
# the desired state.
|
@@ -310,12 +290,11 @@ class LogStash::Agent
|
|
310
290
|
#
|
311
291
|
def converge_state(pipeline_actions)
|
312
292
|
logger.debug("Converging pipelines state", :actions_count => pipeline_actions.size)
|
313
|
-
fail("Illegal access to `LogStash::Agent#converge_state()` without exclusive lock at #{caller[1]}") unless @convergence_lock.owned?
|
314
293
|
|
315
294
|
converge_result = LogStash::ConvergeResult.new(pipeline_actions.size)
|
316
295
|
|
317
296
|
pipeline_actions.map do |action|
|
318
|
-
Thread.new
|
297
|
+
Thread.new do
|
319
298
|
java.lang.Thread.currentThread().setName("Converge #{action}");
|
320
299
|
# We execute every task we need to converge the current state of pipelines
|
321
300
|
# for every task we will record the action result, that will help us
|
@@ -331,36 +310,34 @@ class LogStash::Agent
|
|
331
310
|
# that we currently have.
|
332
311
|
begin
|
333
312
|
logger.debug("Executing action", :action => action)
|
334
|
-
action_result = action.execute(self,
|
313
|
+
action_result = action.execute(self, pipelines)
|
335
314
|
converge_result.add(action, action_result)
|
336
315
|
|
337
316
|
unless action_result.successful?
|
338
|
-
logger.error("Failed to execute action",
|
339
|
-
|
340
|
-
|
341
|
-
:message => action_result.message,
|
342
|
-
:backtrace => action_result.backtrace
|
343
|
-
)
|
317
|
+
logger.error("Failed to execute action", :id => action.pipeline_id,
|
318
|
+
:action_type => action_result.class, :message => action_result.message,
|
319
|
+
:backtrace => action_result.backtrace)
|
344
320
|
end
|
345
|
-
rescue SystemExit
|
321
|
+
rescue SystemExit => e
|
322
|
+
converge_result.add(action, e)
|
323
|
+
rescue Exception => e
|
346
324
|
logger.error("Failed to execute action", :action => action, :exception => e.class.name, :message => e.message, :backtrace => e.backtrace)
|
347
325
|
converge_result.add(action, e)
|
348
326
|
end
|
349
327
|
end
|
350
328
|
end.each(&:join)
|
351
329
|
|
352
|
-
logger.trace?
|
353
|
-
:success => converge_result.success?,
|
354
|
-
|
355
|
-
|
356
|
-
|
330
|
+
if logger.trace?
|
331
|
+
logger.trace("Converge results", :success => converge_result.success?,
|
332
|
+
:failed_actions => converge_result.failed_actions.collect { |a, r| "id: #{a.pipeline_id}, action_type: #{a.class}, message: #{r.message}" },
|
333
|
+
:successful_actions => converge_result.successful_actions.collect { |a, r| "id: #{a.pipeline_id}, action_type: #{a.class}" })
|
334
|
+
end
|
357
335
|
|
358
336
|
converge_result
|
359
337
|
end
|
360
338
|
|
361
339
|
def resolve_actions(pipeline_configs)
|
362
|
-
|
363
|
-
@state_resolver.resolve(@pipelines_registry, pipeline_configs)
|
340
|
+
@state_resolver.resolve(@pipelines, pipeline_configs)
|
364
341
|
end
|
365
342
|
|
366
343
|
def dispatch_events(converge_results)
|
@@ -377,24 +354,20 @@ class LogStash::Agent
|
|
377
354
|
end
|
378
355
|
|
379
356
|
def start_webserver
|
380
|
-
@
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
webserver.run
|
386
|
-
end
|
357
|
+
options = {:http_host => @http_host, :http_ports => @http_port, :http_environment => @http_environment }
|
358
|
+
@webserver = LogStash::WebServer.new(@logger, self, options)
|
359
|
+
@webserver_thread = Thread.new(@webserver) do |webserver|
|
360
|
+
LogStash::Util.set_thread_name("Api Webserver")
|
361
|
+
webserver.run
|
387
362
|
end
|
388
363
|
end
|
389
364
|
|
390
365
|
def stop_webserver
|
391
|
-
@
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
@webserver_thread.join
|
397
|
-
end
|
366
|
+
if @webserver
|
367
|
+
@webserver.stop
|
368
|
+
if @webserver_thread.join(5).nil?
|
369
|
+
@webserver_thread.kill
|
370
|
+
@webserver_thread.join
|
398
371
|
end
|
399
372
|
end
|
400
373
|
end
|
@@ -422,14 +395,25 @@ class LogStash::Agent
|
|
422
395
|
end
|
423
396
|
|
424
397
|
def shutdown_pipelines
|
425
|
-
logger.debug("Shutting down all pipelines", :pipelines_count =>
|
398
|
+
logger.debug("Shutting down all pipelines", :pipelines_count => pipelines_count)
|
426
399
|
|
427
400
|
# In this context I could just call shutdown, but I've decided to
|
428
401
|
# use the stop action implementation for that so we have the same code.
|
429
402
|
# This also give us some context into why a shutdown is failing
|
430
|
-
|
403
|
+
pipeline_actions = resolve_actions([]) # We stop all the pipeline, so we converge to a empty state
|
404
|
+
converge_state(pipeline_actions)
|
431
405
|
end
|
432
406
|
|
407
|
+
def running_pipeline?(pipeline_id)
|
408
|
+
pipeline = get_pipeline(pipeline_id)
|
409
|
+
return false unless pipeline
|
410
|
+
thread = pipeline.thread
|
411
|
+
thread.is_a?(Thread) && thread.alive?
|
412
|
+
end
|
413
|
+
|
414
|
+
def clean_state?
|
415
|
+
pipelines.empty?
|
416
|
+
end
|
433
417
|
|
434
418
|
def setting(key)
|
435
419
|
@settings.get(key)
|
@@ -10,7 +10,7 @@ module LogStash
|
|
10
10
|
# return hot threads information
|
11
11
|
get "/jvm/hot_threads" do
|
12
12
|
begin
|
13
|
-
top_threads_count = params["threads"] ||
|
13
|
+
top_threads_count = params["threads"] || 3
|
14
14
|
ignore_idle_threads = params["ignore_idle_threads"] || true
|
15
15
|
options = {
|
16
16
|
:threads => top_threads_count.to_i,
|
@@ -3,7 +3,6 @@ require "treetop"
|
|
3
3
|
require "logstash/compiler/treetop_monkeypatches"
|
4
4
|
require "logstash/compiler/lscl/helpers"
|
5
5
|
require "logstash/config/string_escape"
|
6
|
-
require "logstash/util"
|
7
6
|
|
8
7
|
java_import org.logstash.config.ir.DSL
|
9
8
|
java_import org.logstash.common.SourceWithMetadata
|
@@ -112,11 +111,11 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC
|
|
112
111
|
# hash value; e.g., `{"match" => {"baz" => "bar"}, "match" => {"foo" => "bulb"}}` is
|
113
112
|
# interpreted as `{"match" => {"baz" => "bar", "foo" => "blub"}}`.
|
114
113
|
# (NOTE: this bypasses `AST::Hash`'s ability to detect duplicate keys)
|
115
|
-
hash[k] =
|
114
|
+
hash[k] = existing.merge(v)
|
116
115
|
elsif existing.kind_of?(::Array)
|
117
116
|
hash[k] = existing.push(*v)
|
118
117
|
else
|
119
|
-
hash[k] =
|
118
|
+
hash[k] = existing + v
|
120
119
|
end
|
121
120
|
hash
|
122
121
|
end
|
@@ -165,8 +164,8 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC
|
|
165
164
|
class Number < Value
|
166
165
|
def expr
|
167
166
|
jdsl.eValue(source_meta, text_value.include?(".") ?
|
168
|
-
|
169
|
-
|
167
|
+
text_value.to_f :
|
168
|
+
text_value.to_i)
|
170
169
|
end
|
171
170
|
end
|
172
171
|
|
@@ -318,9 +317,10 @@ module LogStashCompilerLSCLGrammar; module LogStash; module Compiler; module LSC
|
|
318
317
|
|
319
318
|
def precedence(op)
|
320
319
|
# Believe this is right for logstash?
|
321
|
-
|
320
|
+
case op
|
321
|
+
when AND_METHOD
|
322
322
|
2
|
323
|
-
|
323
|
+
when OR_METHOD
|
324
324
|
1
|
325
325
|
else
|
326
326
|
raise ArgumentError, "Unexpected operator #{op}"
|
@@ -136,7 +136,7 @@ module LogStash; module Config; module AST
|
|
136
136
|
events.each{|e| block.call(e)}
|
137
137
|
end
|
138
138
|
|
139
|
-
if
|
139
|
+
if @generated_objects[:#{name}].respond_to?(:flush)
|
140
140
|
@periodic_flushers << @generated_objects[:#{name}_flush] if @generated_objects[:#{name}].periodic_flush
|
141
141
|
@shutdown_flushers << @generated_objects[:#{name}_flush]
|
142
142
|
end
|
@@ -323,7 +323,7 @@ module LogStash::Config::Mixin
|
|
323
323
|
if config_settings[:list]
|
324
324
|
value = Array(value) # coerce scalars to lists
|
325
325
|
# Empty lists are converted to nils
|
326
|
-
return true,
|
326
|
+
return true, nil if value.empty?
|
327
327
|
|
328
328
|
validated_items = value.map {|v| validate_value(v, config_val)}
|
329
329
|
is_valid = validated_items.all? {|sr| sr[0] }
|
@@ -27,7 +27,7 @@ module LogStash module Config
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if modules_array.empty?
|
30
|
-
# no
|
30
|
+
# no specified modules
|
31
31
|
return pipelines
|
32
32
|
end
|
33
33
|
logger.debug("Specified modules", :modules_array => modules_array.to_s)
|
@@ -73,9 +73,9 @@ module LogStash module Config
|
|
73
73
|
LogStash::Modules::SettingsMerger.merge_kibana_auth!(module_hash)
|
74
74
|
current_module.with_settings(module_hash)
|
75
75
|
config_test = settings.get("config.test_and_exit")
|
76
|
-
|
76
|
+
module_setup = settings.get("modules_setup")
|
77
77
|
# Only import data if it's not a config test and --setup is true
|
78
|
-
if !config_test &&
|
78
|
+
if !config_test && module_setup
|
79
79
|
logger.info("Setting up the #{module_name} module")
|
80
80
|
esclient = LogStash::ElasticsearchClient.build(module_hash)
|
81
81
|
kbnclient = LogStash::Modules::KibanaClient.new(module_hash)
|
@@ -32,9 +32,8 @@ class LogStash::DependencyReport < Clamp::Command
|
|
32
32
|
command = ["./gradlew", "generateLicenseReport", "-PlicenseReportInputCSV=#{ruby_output_path}", "-PlicenseReportOutputCSV=#{output_path}"]
|
33
33
|
puts "Executing #{command}"
|
34
34
|
system(*command)
|
35
|
-
|
36
35
|
if $?.exitstatus != 0
|
37
|
-
raise "
|
36
|
+
raise "Could not run gradle java deps! Exit status #{$?.exitstatus}"
|
38
37
|
end
|
39
38
|
|
40
39
|
nil
|
data/lib/logstash/environment.rb
CHANGED
@@ -33,7 +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", "
|
36
|
+
Setting::String.new("config.field_reference.parser", "STRICT", true, %w(STRICT)),
|
37
37
|
Setting::Boolean.new("metric.collect", true),
|
38
38
|
Setting::String.new("pipeline.id", "main"),
|
39
39
|
Setting::Boolean.new("pipeline.system", false),
|
@@ -42,7 +42,7 @@ module LogStash
|
|
42
42
|
Setting::PositiveInteger.new("pipeline.batch.size", 125),
|
43
43
|
Setting::Numeric.new("pipeline.batch.delay", 50), # in milliseconds
|
44
44
|
Setting::Boolean.new("pipeline.unsafe_shutdown", false),
|
45
|
-
Setting::Boolean.new("pipeline.java_execution",
|
45
|
+
Setting::Boolean.new("pipeline.java_execution", true),
|
46
46
|
Setting::Boolean.new("pipeline.reloadable", true),
|
47
47
|
Setting.new("path.plugins", Array, []),
|
48
48
|
Setting::NullableString.new("interactive", nil, false),
|
@@ -62,7 +62,6 @@ module LogStash
|
|
62
62
|
Setting::Numeric.new("queue.checkpoint.acks", 1024), # 0 is unlimited
|
63
63
|
Setting::Numeric.new("queue.checkpoint.writes", 1024), # 0 is unlimited
|
64
64
|
Setting::Numeric.new("queue.checkpoint.interval", 1000), # 0 is no time-based checkpointing
|
65
|
-
Setting::Boolean.new("queue.checkpoint.retry", false),
|
66
65
|
Setting::Boolean.new("dead_letter_queue.enable", false),
|
67
66
|
Setting::Bytes.new("dead_letter_queue.max_bytes", "1024mb"),
|
68
67
|
Setting::TimeValue.new("slowlog.threshold.warn", "-1"),
|
@@ -164,15 +163,11 @@ module LogStash
|
|
164
163
|
end
|
165
164
|
|
166
165
|
def windows?
|
167
|
-
host_os =~ WINDOW_OS_RE
|
166
|
+
RbConfig::CONFIG['host_os'] =~ WINDOW_OS_RE
|
168
167
|
end
|
169
168
|
|
170
169
|
def linux?
|
171
|
-
host_os =~ LINUX_OS_RE
|
172
|
-
end
|
173
|
-
|
174
|
-
def host_os
|
175
|
-
RbConfig::CONFIG['host_os']
|
170
|
+
RbConfig::CONFIG['host_os'] =~ LINUX_OS_RE
|
176
171
|
end
|
177
172
|
|
178
173
|
def locales_path(path)
|
data/lib/logstash/event.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# transient pipeline events for normal in-flow signaling as opposed to
|
6
|
-
# flow altering exceptions. for now having base classes is adequate and
|
7
|
-
# in the future it might be necessary to refactor using like a BaseEvent
|
8
|
-
# class to have a common interface for all pipeline events to support
|
9
|
-
# eventual queueing persistence for example, TBD.
|
3
|
+
# used only in the Ruby execution engine
|
10
4
|
module LogStash
|
11
5
|
class SignalEvent
|
12
6
|
def flush?; raise "abstract method"; end;
|
@@ -31,21 +25,4 @@ module LogStash
|
|
31
25
|
FLUSH = FlushEvent.new
|
32
26
|
SHUTDOWN = ShutdownEvent.new
|
33
27
|
NO_SIGNAL = NoSignal.new
|
34
|
-
|
35
|
-
class Event
|
36
|
-
MSG_BRACKETS_METHOD_MISSING = "Direct event field references (i.e. event['field']) have been disabled in favor of using event get and set methods (e.g. event.get('field')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
|
37
|
-
MSG_BRACKETS_EQUALS_METHOD_MISSING = "Direct event field references (i.e. event['field'] = 'value') have been disabled in favor of using event get and set methods (e.g. event.set('field', 'value')). Please consult the Logstash 5.0 breaking changes documentation for more details.".freeze
|
38
|
-
RE_BRACKETS_METHOD = /^\[\]$/.freeze
|
39
|
-
RE_BRACKETS_EQUALS_METHOD = /^\[\]=$/.freeze
|
40
|
-
|
41
|
-
def method_missing(method_name, *arguments, &block)
|
42
|
-
if RE_BRACKETS_METHOD.match(method_name.to_s)
|
43
|
-
raise NoMethodError.new(MSG_BRACKETS_METHOD_MISSING)
|
44
|
-
end
|
45
|
-
if RE_BRACKETS_EQUALS_METHOD.match(method_name.to_s)
|
46
|
-
raise NoMethodError.new(MSG_BRACKETS_EQUALS_METHOD_MISSING)
|
47
|
-
end
|
48
|
-
super
|
49
|
-
end
|
50
|
-
end
|
51
28
|
end
|
@@ -1,2 +1,69 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
module LogStash
|
4
|
+
class FilterDelegator
|
5
|
+
extend Forwardable
|
6
|
+
DELEGATED_METHODS = [
|
7
|
+
:register,
|
8
|
+
:close,
|
9
|
+
:threadsafe?,
|
10
|
+
:do_close,
|
11
|
+
:do_stop,
|
12
|
+
:periodic_flush,
|
13
|
+
:reloadable?
|
14
|
+
]
|
15
|
+
def_delegators :@filter, *DELEGATED_METHODS
|
16
|
+
|
17
|
+
attr_reader :id
|
18
|
+
|
19
|
+
def initialize(filter, id)
|
20
|
+
@klass = filter.class
|
21
|
+
@id = id
|
22
|
+
@filter = filter
|
23
|
+
|
24
|
+
# Scope the metrics to the plugin
|
25
|
+
namespaced_metric = filter.metric
|
26
|
+
@metric_events = namespaced_metric.namespace(:events)
|
27
|
+
@metric_events_in = @metric_events.counter(:in)
|
28
|
+
@metric_events_out = @metric_events.counter(:out)
|
29
|
+
@metric_events_time = @metric_events.counter(:duration_in_millis)
|
30
|
+
namespaced_metric.gauge(:name, config_name)
|
31
|
+
|
32
|
+
# Not all the filters will do bufferings
|
33
|
+
define_flush_method if @filter.respond_to?(:flush)
|
34
|
+
end
|
35
|
+
|
36
|
+
def config_name
|
37
|
+
@klass.config_name
|
38
|
+
end
|
39
|
+
|
40
|
+
def multi_filter(events)
|
41
|
+
@metric_events_in.increment(events.size)
|
42
|
+
|
43
|
+
start_time = java.lang.System.nano_time
|
44
|
+
new_events = @filter.multi_filter(events)
|
45
|
+
@metric_events_time.increment((java.lang.System.nano_time - start_time) / 1_000_000)
|
46
|
+
|
47
|
+
# There is no guarantee in the context of filter
|
48
|
+
# that EVENTS_IN == EVENTS_OUT, see the aggregates and
|
49
|
+
# the split filter
|
50
|
+
c = new_events.count { |event| !event.cancelled? }
|
51
|
+
@metric_events_out.increment(c) if c > 0
|
52
|
+
new_events
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def define_flush_method
|
57
|
+
define_singleton_method(:flush) do |options = {}|
|
58
|
+
# we also need to trace the number of events
|
59
|
+
# coming from a specific filters.
|
60
|
+
new_events = @filter.flush(options)
|
61
|
+
|
62
|
+
# Filter plugins that does buffering or spooling of events like the
|
63
|
+
# `Logstash-filter-aggregates` can return `NIL` and will flush on the next flush ticks.
|
64
|
+
@metric_events_out.increment(new_events.size) if new_events && new_events.size > 0
|
65
|
+
new_events
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -194,6 +194,8 @@ class LogStash::Filters::Base < LogStash::Plugin
|
|
194
194
|
# this is important because a construct like event["tags"].delete(tag) will not work
|
195
195
|
# in the current Java event implementation. see https://github.com/elastic/logstash/issues/4140
|
196
196
|
|
197
|
+
return if @remove_tag.empty?
|
198
|
+
|
197
199
|
tags = event.get("tags")
|
198
200
|
return unless tags
|
199
201
|
|
@@ -302,7 +302,7 @@ module LogStash module Instrument
|
|
302
302
|
#
|
303
303
|
# @param [Concurrent::Map] Map to search for the key
|
304
304
|
# @param [Array] List of path to create
|
305
|
-
# @param [
|
305
|
+
# @param [Fixnum] Which part from the list to create
|
306
306
|
#
|
307
307
|
def fetch_or_store_namespace_recursively(map, namespaces_path, idx = 0)
|
308
308
|
current = namespaces_path[idx]
|
@@ -10,11 +10,13 @@ module LogStash module Instrument module PeriodicPoller
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def collect
|
13
|
-
pipelines = @agent.
|
14
|
-
pipelines.
|
15
|
-
|
16
|
-
pipeline.
|
17
|
-
|
13
|
+
pipelines = @agent.with_running_user_defined_pipelines {|pipelines| pipelines}
|
14
|
+
unless pipelines.nil?
|
15
|
+
pipelines.each {|_, pipeline|
|
16
|
+
unless pipeline.nil?
|
17
|
+
pipeline.collect_dlq_stats
|
18
|
+
end
|
19
|
+
}
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -20,8 +20,8 @@ java_import 'org.logstash.instrument.reports.ProcessReport'
|
|
20
20
|
module LogStash module Instrument module PeriodicPoller
|
21
21
|
class JVM < Base
|
22
22
|
class GarbageCollectorName
|
23
|
-
YOUNG_GC_NAMES = Set.new(["Copy", "PS Scavenge", "ParNew", "G1 Young Generation", "scavenge"
|
24
|
-
OLD_GC_NAMES = Set.new(["MarkSweepCompact", "PS MarkSweep", "ConcurrentMarkSweep", "G1 Old Generation", "global"
|
23
|
+
YOUNG_GC_NAMES = Set.new(["Copy", "PS Scavenge", "ParNew", "G1 Young Generation", "scavenge"])
|
24
|
+
OLD_GC_NAMES = Set.new(["MarkSweepCompact", "PS MarkSweep", "ConcurrentMarkSweep", "G1 Old Generation", "global"])
|
25
25
|
|
26
26
|
YOUNG = :young
|
27
27
|
OLD = :old
|
@@ -68,7 +68,7 @@ module LogStash module Instrument module PeriodicPoller
|
|
68
68
|
logger.debug("collector name", :name => collector_name)
|
69
69
|
name = GarbageCollectorName.get(collector_name)
|
70
70
|
if name.nil?
|
71
|
-
logger.error("Unknown garbage collector name", :name =>
|
71
|
+
logger.error("Unknown garbage collector name", :name => name)
|
72
72
|
else
|
73
73
|
metric.gauge([:jvm, :gc, :collectors, name], :collection_count, collector.getCollectionCount())
|
74
74
|
metric.gauge([:jvm, :gc, :collectors, name], :collection_time_in_millis, collector.getCollectionTime())
|