logstash-input-dead_letter_queue 1.1.8 → 1.1.9

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: 409103b04b24b573dff867b4a59f58dbfaad926f4fd8a390cbf08d4243b0976b
4
- data.tar.gz: a911df00dc53b67bdf4bf9f2cf4d4f321a89dd9e7eb8e8862658deaddcc305d0
3
+ metadata.gz: a8c3914781267098a3ca870e2497905c0ce1c7fb8d8faf641744391f5e488066
4
+ data.tar.gz: 2ccac6b74e55459931228ae0cb1a1766b5e79b03a2333c7e6bec325156a0c9fa
5
5
  SHA512:
6
- metadata.gz: 5b7a8789b7b9ff113a1aec644e4f8f4e32379d439dbc0ac555eb291e226ad81fc0b36aa5f14afe1ffeed3f7617a3d35a9a1123310f956cc71f7d14038c75f4eb
7
- data.tar.gz: 845256cb793ca177652719dcd588ca294a70df4575234deb71d1af619c0ce58931ae6cd6cd0ab93ad852160bedbe8e7f2ce4d541656590a3b31568c6e5b02910
6
+ metadata.gz: 285bd36daf838edda23f623868f6efeb63af4a8243cc7c9328a574981c2d7819425156a79a8e99f50fb2fd8d09924f639d0dd115ead5f12554b6888bce59a5eb
7
+ data.tar.gz: 6fea6fdd41eb183894e6c7970686c7b86b2577f77081a6cf7015dd49a4ce9f1b1b1f878d215912c3b047d8c1dfa1830a4b22aaf2fa4024b2e83ea755fa32b52c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.9
2
+ - Fix `@metadata` get overwritten by reestablishing metadata that stored in DLQ [#34](https://github.com/logstash-plugins/logstash-input-dead_letter_queue/pull/34)
3
+
1
4
  ## 1.1.8
2
5
  - Update dependencies for log4j to 2.17.1
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.8
1
+ 1.1.9
@@ -58,7 +58,15 @@ class LogStash::Inputs::DeadLetterQueue < LogStash::Inputs::Base
58
58
  public
59
59
  def run(logstash_queue)
60
60
  @inner_plugin.run do |entry|
61
- event = LogStash::Event.new(entry.event.toMap())
61
+ clone = entry.event.clone()
62
+ event = if Gem::Requirement.new('< 7.0').satisfied_by?(Gem::Version.new(LOGSTASH_CORE_VERSION))
63
+ # LS 6 LogStash::Event.new accept Map not Event
64
+ event = LogStash::Event.new(clone.getData())
65
+ event.set("[@metadata]", clone.getMetadata())
66
+ event
67
+ else
68
+ LogStash::Event.new(clone)
69
+ end
62
70
  event.set("[@metadata][dead_letter_queue][plugin_type]", entry.plugin_type)
63
71
  event.set("[@metadata][dead_letter_queue][plugin_id]", entry.plugin_id)
64
72
  event.set("[@metadata][dead_letter_queue][reason]", entry.reason)
@@ -1,4 +1,4 @@
1
1
  # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
2
2
 
3
3
  require 'jar_dependencies'
4
- require_jar('co.elastic.logstash.input', 'logstash-input-dead_letter_queue', '1.1.8')
4
+ require_jar('co.elastic.logstash.input', 'logstash-input-dead_letter_queue', '1.1.9')
@@ -19,8 +19,35 @@ describe LogStash::Inputs::DeadLetterQueue do
19
19
  expect {subject.register}.to_not raise_error
20
20
  end
21
21
 
22
-
23
22
  after(:each) do
24
23
  FileUtils.remove_entry_secure directory
25
24
  end
25
+
26
+ context 'test with real DLQ file' do
27
+ let(:dlq_dir) { Stud::Temporary.directory }
28
+ let(:fixture_dir) { File.expand_path(File.join(File.dirname(__FILE__),"fixtures", "main")) }
29
+ let(:plugin) { LogStash::Inputs::DeadLetterQueue.new({ "path" => dlq_dir, "commit_offsets" => true }) }
30
+ let(:queue) { Queue.new }
31
+
32
+ before do
33
+ FileUtils.cp_r fixture_dir, dlq_dir
34
+ end
35
+
36
+ it 'reserve original metadata' do
37
+ plugin.register
38
+ t = Thread.new {
39
+ begin
40
+ plugin.run(queue)
41
+ rescue java.nio.file.ClosedWatchServiceException => e
42
+ end
43
+ }
44
+
45
+ event = queue.pop
46
+ expect(event.get("[@metadata][some_key]")).to eq("some_value")
47
+ expect(event.get("[@metadata][dead_letter_queue][reason]")).to match(/Could not index event to Elasticsearch. status: 400/)
48
+
49
+ plugin.stop
50
+ t.join(1000)
51
+ end
52
+ end
26
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-dead_letter_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-05 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,8 @@ files:
79
79
  - lib/logstash/inputs/dead_letter_queue.rb
80
80
  - logstash-input-dead_letter_queue.gemspec
81
81
  - spec/unit/inputs/dead_letter_queue_spec.rb
82
- - vendor/jar-dependencies/co/elastic/logstash/input/logstash-input-dead_letter_queue/1.1.8/logstash-input-dead_letter_queue-1.1.8.jar
82
+ - spec/unit/inputs/fixtures/main/1.log
83
+ - vendor/jar-dependencies/co/elastic/logstash/input/logstash-input-dead_letter_queue/1.1.9/logstash-input-dead_letter_queue-1.1.9.jar
83
84
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
84
85
  licenses:
85
86
  - Apache License (2.0)
@@ -108,3 +109,4 @@ specification_version: 4
108
109
  summary: read events from Logstash's dead letter queue
109
110
  test_files:
110
111
  - spec/unit/inputs/dead_letter_queue_spec.rb
112
+ - spec/unit/inputs/fixtures/main/1.log