logstash-input-beats 6.7.1-java → 6.8.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 633344379c679c34cba9b726bf6743f8dad7da7b65b4266e647d1539c3ef3a08
4
- data.tar.gz: 340d1c62e61b64f6787a8e87df877cfd6073aa42ff9601504f21272119fc9937
3
+ metadata.gz: e795cf7e189345d1cf4ef96dfadc1185d2e73b63be07674654ce06342adaff86
4
+ data.tar.gz: 55bce211f32a39ebea8197b46ebdf83e0832d043a785d54dc9f6917bd5132ab2
5
5
  SHA512:
6
- metadata.gz: 779e37e64ba62a4fd988a535866f393bb4797980eee02260b56ddf145194f398f1c2abfb5708d1939279bb4fcf2a6cba0b59b061ea59ea8c57d2a700d64e2e81
7
- data.tar.gz: 39f78d631e00518b17af3d88109b3c41f58a3e9ef61d26e7e2a7c97eb0fb0c915b6f7d994b6975d5fd4d0f95cf5e24a54b7d959b373b501dacda8d639c19b04f
6
+ metadata.gz: 654adc75a917802031a32ba3d02279a135f0817e90833fe2bca54261fda59debe82072e0ecdf0f14bc5996afd644d0da36f9e9ed702456a76358d7d1d6a0e458
7
+ data.tar.gz: 72093407b408492a8a7bbaf57d5694a64f1b56c99e418726c91727d2fcc0b4ea7ca85da22344db0a51b4b6196b5d3ad3d78c2da213c8e653087ef4949c8e1e73
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.8.0
2
+ - Introduce expert only `event_loop_threads` to tune netty event loop threads count [#490](https://github.com/logstash-plugins/logstash-input-beats/pull/490)
3
+
4
+ ## 6.7.2
5
+ - Restore accidentally removed Lumberjack event parse source lines [#486](https://github.com/logstash-plugins/logstash-input-beats/pull/486)
6
+
1
7
  ## 6.7.1
2
8
  - bump netty to 4.1.100 and jackson to 2.15.3 [#484](https://github.com/logstash-plugins/logstash-input-beats/pull/484)
3
9
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.7.1
1
+ 6.8.0
data/docs/index.asciidoc CHANGED
@@ -217,6 +217,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
217
217
  | <<plugins-{type}s-{plugin}-client_inactivity_timeout>> |<<number,number>>|No
218
218
  | <<plugins-{type}s-{plugin}-ecs_compatibility>> | <<string,string>>|No
219
219
  | <<plugins-{type}s-{plugin}-enrich>> |<<string,string>>|No
220
+ | <<plugins-{type}s-{plugin}-event_loop_threads>> |<<number,number>>|No
220
221
  | <<plugins-{type}s-{plugin}-executor_threads>> |<<number,number>>|No
221
222
  | <<plugins-{type}s-{plugin}-host>> |<<string,string>>|No
222
223
  | <<plugins-{type}s-{plugin}-include_codec_tag>> |<<boolean,boolean>>|__Deprecated__
@@ -339,6 +340,20 @@ input {
339
340
  }
340
341
  --------------------------------------------------
341
342
 
343
+ [id="plugins-{type}s-{plugin}-event_loop_threads"]
344
+ ===== `event_loop_threads`
345
+
346
+ * Value type is <<number,number>>
347
+ * Defaults to 0.
348
+
349
+ When setting `0`, the actual default is `available_processors * 2`
350
+
351
+ This is an expert-level setting, and generally should not need to be set
352
+ {plugin-uc} plugin is implemented based on a non-blocking mechanism, requiring a number of event loop and executor threads.
353
+ The event loop threads are responsible to communicate with clients (accept incoming connections, enqueue/dequeue tasks and respond) and executor threads handle tasks.
354
+ This configuration intends to limit or increase the number of threads to be created for the event loop.
355
+ See <<plugins-{type}s-{plugin}-executor_threads>> configuration if you need to set executor threads count.
356
+
342
357
  [id="plugins-{type}s-{plugin}-executor_threads"]
343
358
  ===== `executor_threads`
344
359
 
@@ -9,6 +9,7 @@ module LogStash module Inputs class Beats
9
9
  include org.logstash.beats.IMessageListener
10
10
 
11
11
  FILEBEAT_LOG_LINE_FIELD = "message".freeze
12
+ LSF_LOG_LINE_FIELD = "line".freeze
12
13
 
13
14
  ConnectionState = Struct.new(:ctx, :codec, :ip_address)
14
15
 
@@ -182,6 +183,8 @@ module LogStash module Inputs class Beats
182
183
  def extract_target_field(hash)
183
184
  if from_filebeat?(hash)
184
185
  hash.delete(FILEBEAT_LOG_LINE_FIELD).to_s
186
+ elsif from_logstash_forwarder?(hash)
187
+ hash.delete(LSF_LOG_LINE_FIELD).to_s
185
188
  end
186
189
  end
187
190
 
@@ -189,6 +192,10 @@ module LogStash module Inputs class Beats
189
192
  !hash[FILEBEAT_LOG_LINE_FIELD].nil?
190
193
  end
191
194
 
195
+ def from_logstash_forwarder?(hash)
196
+ !hash[LSF_LOG_LINE_FIELD].nil?
197
+ end
198
+
192
199
  def increment_connection_count
193
200
  current_connection_count = @connections_list.size
194
201
  @metric.gauge(:current_connections, current_connection_count)
@@ -141,6 +141,10 @@ class LogStash::Inputs::Beats < LogStash::Inputs::Base
141
141
  # Beats handler executor thread
142
142
  config :executor_threads, :validate => :number, :default => LogStash::Config::CpuCoreStrategy.maximum
143
143
 
144
+ # Expert only setting which set's Netty Event Loop Group thread count
145
+ # defaults to zero where Netty's DEFAULT_EVENT_LOOP_THREADS (NettyRuntime.availableProcessors() * 2) will be applied
146
+ config :event_loop_threads, :validate => :number, :default => 0
147
+
144
148
  # Flag to determine whether to add host information (provided by the beat in the 'hostname' field) to the event
145
149
  config :add_hostname, :validate => :boolean, :default => false, :deprecated => 'This option will be removed in the future as beats determine the event schema'
146
150
 
@@ -243,7 +247,7 @@ class LogStash::Inputs::Beats < LogStash::Inputs::Base
243
247
  end # def register
244
248
 
245
249
  def create_server
246
- server = org.logstash.beats.Server.new(@host, @port, @client_inactivity_timeout, @executor_threads)
250
+ server = org.logstash.beats.Server.new(@host, @port, @client_inactivity_timeout, @event_loop_threads, @executor_threads)
247
251
  server.setSslHandlerProvider(new_ssl_handshake_provider(new_ssl_context_builder)) if @ssl_enabled
248
252
  server
249
253
  end
@@ -8,4 +8,4 @@ require_jar('io.netty', 'netty-transport', '4.1.100.Final')
8
8
  require_jar('io.netty', 'netty-handler', '4.1.100.Final')
9
9
  require_jar('io.netty', 'netty-transport-native-unix-common', '4.1.100.Final')
10
10
  require_jar('org.javassist', 'javassist', '3.24.0-GA')
11
- require_jar('org.logstash.beats', 'logstash-input-beats', '6.7.1')
11
+ require_jar('org.logstash.beats', 'logstash-input-beats', '6.8.0')
data/lib/tasks/test.rake CHANGED
@@ -9,6 +9,8 @@ elsif OS_PLATFORM == "darwin"
9
9
  FILEBEAT_URL = "https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.6.0-darwin-x86_64.tar.gz"
10
10
  end
11
11
 
12
+ LSF_URL = "https://download.elastic.co/logstash-forwarder/binaries/logstash-forwarder_#{OS_PLATFORM}_amd64"
13
+
12
14
  require "fileutils"
13
15
  @files=[]
14
16
 
@@ -25,9 +27,21 @@ namespace :test do
25
27
  namespace :integration do
26
28
  task :setup do
27
29
  Rake::Task["test:integration:setup:filebeat"].invoke
30
+ Rake::Task["test:integration:setup:lsf"].invoke
28
31
  end
29
32
 
30
33
  namespace :setup do
34
+ desc "Download latest stable version of Logstash-forwarder"
35
+ task :lsf do
36
+ destination = File.join(VENDOR_PATH, "logstash-forwarder")
37
+ FileUtils.rm_rf(destination)
38
+ FileUtils.mkdir_p(destination)
39
+ download_destination = File.join(destination, "logstash-forwarder")
40
+ puts "Logstash-forwarder: downloading from #{LSF_URL} to #{download_destination}"
41
+ download(LSF_URL, download_destination)
42
+ File.chmod(0755, download_destination)
43
+ end
44
+
31
45
  desc "Download nigthly filebeat for integration testing"
32
46
  task :filebeat do
33
47
  FileUtils.mkdir_p(VENDOR_PATH)
@@ -46,7 +60,7 @@ namespace :test do
46
60
  end
47
61
 
48
62
  # Uncompress all the file from the archive this only work with
49
- # one level directory structure and filebeat packaging.
63
+ # one level directory structure and its fine for LSF and filebeat packaging.
50
64
  def untar_all(file, destination)
51
65
  untar(file) do |entry|
52
66
  out = entry.full_name.split("/").last
@@ -199,6 +199,16 @@ describe LogStash::Inputs::Beats::MessageListener do
199
199
  end
200
200
  end
201
201
 
202
+ context "when the message is from LSF" do
203
+ let(:message) { MockMessage.new("abc", { "line" => "hello world", '@metadata' => {} } )}
204
+
205
+ it "extract the event" do
206
+ subject.onNewMessage(ctx, message)
207
+ event = queue.pop
208
+ expect(event.get("message")).to eq("hello world")
209
+ end
210
+ end
211
+
202
212
  it_behaves_like "when the message is from any libbeat", :disabled, "[@metadata][ip_address]"
203
213
  it_behaves_like "when the message is from any libbeat", :v1, "[@metadata][input][beats][host][ip]"
204
214
  it_behaves_like "when the message is from any libbeat", :v8, "[@metadata][input][beats][host][ip]"
@@ -13,7 +13,8 @@ describe LogStash::Inputs::Beats do
13
13
  let(:certificate) { BeatsInputTest.certificate }
14
14
  let(:port) { BeatsInputTest.random_port }
15
15
  let(:client_inactivity_timeout) { 400 }
16
- let(:threads) { 1 + rand(9) }
16
+ let(:event_loop_threads) { 1 + rand(4) }
17
+ let(:executor_threads) { 1 + rand(9) }
17
18
  let(:queue) { Queue.new }
18
19
  let(:config) do
19
20
  {
@@ -21,7 +22,8 @@ describe LogStash::Inputs::Beats do
21
22
  "ssl_certificate" => certificate.ssl_cert,
22
23
  "ssl_key" => certificate.ssl_key,
23
24
  "client_inactivity_timeout" => client_inactivity_timeout,
24
- "executor_threads" => threads,
25
+ "event_loop_threads" => event_loop_threads,
26
+ "executor_threads" => executor_threads,
25
27
  "type" => "example",
26
28
  "tags" => "beats"
27
29
  }
@@ -36,7 +38,7 @@ describe LogStash::Inputs::Beats do
36
38
  let(:port) { 9001 }
37
39
 
38
40
  it "sends the required options to the server" do
39
- expect(org.logstash.beats.Server).to receive(:new).with(host, port, client_inactivity_timeout, threads)
41
+ expect(org.logstash.beats.Server).to receive(:new).with(host, port, client_inactivity_timeout, event_loop_threads, executor_threads)
40
42
  subject.register
41
43
  end
42
44
  end
@@ -529,8 +531,8 @@ describe LogStash::Inputs::Beats do
529
531
  subject(:plugin) { LogStash::Inputs::Beats.new(config) }
530
532
 
531
533
  before do
532
- @server = org.logstash.beats.Server.new(host, port, client_inactivity_timeout, threads)
533
- expect( org.logstash.beats.Server ).to receive(:new).with(host, port, client_inactivity_timeout, threads).and_return @server
534
+ @server = org.logstash.beats.Server.new(host, port, client_inactivity_timeout, event_loop_threads, executor_threads)
535
+ expect( org.logstash.beats.Server ).to receive(:new).with(host, port, client_inactivity_timeout, event_loop_threads, executor_threads).and_return @server
534
536
  expect( @server ).to receive(:listen)
535
537
 
536
538
  subject.register
@@ -0,0 +1,108 @@
1
+ # encoding: utf-8
2
+ require "logstash/inputs/beats"
3
+ require "logstash/json"
4
+ require "fileutils"
5
+ require_relative "../support/flores_extensions"
6
+ require_relative "../support/file_helpers"
7
+ require_relative "../support/integration_shared_context"
8
+ require_relative "../support/client_process_helpers"
9
+ require "spec_helper"
10
+
11
+ LSF_BINARY = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "vendor", "logstash-forwarder", "logstash-forwarder"))
12
+
13
+ describe "Logstash-Forwarder", :integration => true do
14
+ include ClientProcessHelpers
15
+
16
+ before :all do
17
+ unless File.exist?(LSF_BINARY)
18
+ raise "Cannot find `logstash-forwarder` binary in `vendor/logstash-forwarder` Did you run `bundle exec rake test:integration:setup` before running the integration suite?"
19
+ end
20
+ end
21
+
22
+ include FileHelpers
23
+ include_context "beats configuration"
24
+
25
+ let(:client_wait_time) { 5 }
26
+
27
+ # Filebeat related variables
28
+ let(:cmd) { [lsf_exec, "-config", lsf_config_path] }
29
+
30
+ let(:lsf_exec) { LSF_BINARY }
31
+ let(:registry_file) { File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".logstash-forwarder")) }
32
+ let_tmp_file(:lsf_config_path) { lsf_config }
33
+ let(:log_file) { f = Stud::Temporary.file; f.close; f.path }
34
+ let(:lsf_config) do
35
+ <<-CONFIG
36
+ {
37
+ "network": {
38
+ "servers": [ "#{host}:#{port}" ],
39
+ "ssl ca": "#{certificate_authorities}"
40
+ },
41
+ "files": [
42
+ { "paths": [ "#{log_file}" ] }
43
+ ]
44
+ }
45
+ CONFIG
46
+ end
47
+ #
48
+
49
+ before :each do
50
+ FileUtils.rm_rf(registry_file) # ensure clean state between runs
51
+ start_client
52
+ sleep(1)
53
+ # let LSF start and than write the logs
54
+ File.open(log_file, "a") do |f|
55
+ f.write(events.join("\n") + "\n")
56
+ end
57
+ sleep(1) # give some time to the clients to pick up the changes
58
+ end
59
+
60
+ after :each do
61
+ stop_client
62
+ end
63
+
64
+ xcontext "Plain TCP" do
65
+ include ClientProcessHelpers
66
+
67
+ let(:certificate_authorities) { "" }
68
+
69
+ it "should not send any events" do
70
+ expect(queue.size).to eq(0), @execution_output
71
+ end
72
+ end
73
+
74
+ context "TLS" do
75
+ context "Server Verification" do
76
+ let(:input_config) do
77
+ super().merge({
78
+ "ssl_enabled" => true,
79
+ "ssl_certificate" => certificate_file,
80
+ "ssl_key" => certificate_key_file,
81
+ })
82
+ end
83
+
84
+ let(:certificate_data) { Flores::PKI.generate }
85
+ let_tmp_file(:certificate_file) { certificate_data.first }
86
+ let_tmp_file(:certificate_key_file) { convert_to_pkcs8(certificate_data.last) }
87
+ let(:certificate_authorities) { certificate_file }
88
+
89
+ context "self signed certificate" do
90
+ include_examples "send events"
91
+ end
92
+
93
+ context "with large batches" do
94
+ let(:number_of_events) { 10_000 }
95
+ include_examples "send events"
96
+ end
97
+
98
+ context "invalid CA on the client" do
99
+ let(:invalid_data) { Flores::PKI.generate }
100
+ let(:certificate_authorities) { f = Stud::Temporary.file; f.close; f.path }
101
+
102
+ it "should not send any events" do
103
+ expect(queue.size).to eq(0), @execution_output
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-beats
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.7.1
4
+ version: 6.8.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-18 00:00:00.000000000 Z
11
+ date: 2024-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -311,6 +311,7 @@ files:
311
311
  - spec/inputs/beats/tls_spec.rb
312
312
  - spec/inputs/beats_spec.rb
313
313
  - spec/integration/filebeat_spec.rb
314
+ - spec/integration/logstash_forwarder_spec.rb
314
315
  - spec/spec_helper.rb
315
316
  - spec/support/client_process_helpers.rb
316
317
  - spec/support/file_helpers.rb
@@ -326,7 +327,7 @@ files:
326
327
  - vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.100.Final/netty-transport-native-unix-common-4.1.100.Final.jar
327
328
  - vendor/jar-dependencies/io/netty/netty-transport/4.1.100.Final/netty-transport-4.1.100.Final.jar
328
329
  - vendor/jar-dependencies/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA.jar
329
- - vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/6.7.1/logstash-input-beats-6.7.1.jar
330
+ - vendor/jar-dependencies/org/logstash/beats/logstash-input-beats/6.8.0/logstash-input-beats-6.8.0.jar
330
331
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
331
332
  licenses:
332
333
  - Apache License (2.0)
@@ -362,6 +363,7 @@ test_files:
362
363
  - spec/inputs/beats/tls_spec.rb
363
364
  - spec/inputs/beats_spec.rb
364
365
  - spec/integration/filebeat_spec.rb
366
+ - spec/integration/logstash_forwarder_spec.rb
365
367
  - spec/spec_helper.rb
366
368
  - spec/support/client_process_helpers.rb
367
369
  - spec/support/file_helpers.rb