logstash-input-beats 6.7.1-java → 6.7.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 633344379c679c34cba9b726bf6743f8dad7da7b65b4266e647d1539c3ef3a08
4
- data.tar.gz: 340d1c62e61b64f6787a8e87df877cfd6073aa42ff9601504f21272119fc9937
3
+ metadata.gz: cfe0b8587cd80a4285628570381bf998f5765e4d779ee02173b18c90cea621cc
4
+ data.tar.gz: 9f7b15e3627e6b6a594b9e2227185a7875b321d0a7062639d06332047480a59e
5
5
  SHA512:
6
- metadata.gz: 779e37e64ba62a4fd988a535866f393bb4797980eee02260b56ddf145194f398f1c2abfb5708d1939279bb4fcf2a6cba0b59b061ea59ea8c57d2a700d64e2e81
7
- data.tar.gz: 39f78d631e00518b17af3d88109b3c41f58a3e9ef61d26e7e2a7c97eb0fb0c915b6f7d994b6975d5fd4d0f95cf5e24a54b7d959b373b501dacda8d639c19b04f
6
+ metadata.gz: 7f4f396f596f515f4194083e8e590a83a84e4d6f1e222f7a12de1a3dcb7483c830654f806781ab1fa494568f562fbfccfed09f0a40780858fcec70bf4a46c1e0
7
+ data.tar.gz: 1307df00e5d5edc2325020dbd8dd0f1902dcf4404412869f254a2b9303560267cebae254cf4852138533b8a6281ce599fb2d86312c2077792982338d9f471e3e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 6.7.2
2
+ - Restore accidentally removed Lumberjack event parse source lines [#486](https://github.com/logstash-plugins/logstash-input-beats/pull/486)
3
+
1
4
  ## 6.7.1
2
5
  - bump netty to 4.1.100 and jackson to 2.15.3 [#484](https://github.com/logstash-plugins/logstash-input-beats/pull/484)
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.7.1
1
+ 6.7.2
@@ -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)
@@ -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.7.2')
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]"
@@ -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.7.2
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: 2023-11-20 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.7.2/logstash-input-beats-6.7.2.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