logstash-output-elasticsearch 11.9.0-java → 11.9.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +1 -1
- data/docs/index.asciidoc +2 -1
- data/lib/logstash/outputs/elasticsearch/http_client.rb +4 -0
- data/lib/logstash/outputs/elasticsearch.rb +32 -18
- data/lib/logstash/plugin_mixins/elasticsearch/common.rb +3 -4
- data/logstash-output-elasticsearch.gemspec +2 -1
- data/spec/integration/outputs/index_spec.rb +1 -1
- data/spec/integration/outputs/unsupported_actions_spec.rb +75 -0
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +1 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +101 -2
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a26389aead9d5d86292685ab80eef56c151a8cd63f5bb3e3c3d05e5a7b45520
|
4
|
+
data.tar.gz: e28c84ccf3b74806010f1003210833dfc834aafff29201b62887cdd3ab626e51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28faa92933a6959a6d8a8b898d6c87428dfec93125063df7489859d11fdceba0e64c7733d2c77de9f6c241859923563488d2bf4f04f40b1b830f760697efb578
|
7
|
+
data.tar.gz: 821823a2d64c68a8183471366297c299fa771a149c3d03847bc63489ff908d2757a8c7344be9f30b3b34c291eaeaed9694329e7671d7b9ae86eb5ff1445ce820
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 11.9.2
|
2
|
+
- Fix broken link to Logstash Reference [#1085](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1085)
|
3
|
+
|
4
|
+
## 11.9.1
|
5
|
+
- Fixes a possible infinite-retry-loop that could occur when this plugin is configured with an `action` whose value contains a [sprintf-style placeholder][] that fails to be resolved for an individual event. Events in this state will be routed to the pipeline's [dead letter queue][DLQ] if it is available, or will be logged-and-dropped so that the remaining events in the batch can be processed [#1080](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1080)
|
6
|
+
|
7
|
+
[sprintf-style placeholder]: https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf
|
8
|
+
[DLQ]: https://www.elastic.co/guide/en/logstash/current/dead-letter-queues.html
|
9
|
+
|
1
10
|
## 11.9.0
|
2
11
|
- Feature: force unresolved dynamic index names to be sent into DLQ. This feature could be explicitly disabled using `dlq_on_failed_indexname_interpolation` setting [#1084](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1084)
|
3
12
|
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/log
|
|
19
19
|
|
20
20
|
## Developing
|
21
21
|
|
22
|
-
### 1. Plugin
|
22
|
+
### 1. Plugin Development and Testing
|
23
23
|
|
24
24
|
#### Code
|
25
25
|
- To get started, you'll need JRuby with the Bundler gem installed.
|
data/docs/index.asciidoc
CHANGED
@@ -395,7 +395,8 @@ The Elasticsearch action to perform. Valid actions are:
|
|
395
395
|
document if not already present. See the `doc_as_upsert` option. NOTE: This does not work and is not supported
|
396
396
|
in Elasticsearch 1.x. Please upgrade to ES 2.x or greater to use this feature with Logstash!
|
397
397
|
- A sprintf style string to change the action based on the content of the event. The value `%{[foo]}`
|
398
|
-
would use the foo field for the action
|
398
|
+
would use the foo field for the action.
|
399
|
+
If resolved action is not in [`index`, `delete`, `create`, `update`], the event will not be sent to {es}, and will instead either be sent to the pipeline's {logstash-ref}/dead-letter-queues.html[dead-letter-queues] if it is enabled, or will be logged and dropped.
|
399
400
|
|
400
401
|
For more details on actions, check out the {ref}/docs-bulk.html[Elasticsearch bulk API documentation].
|
401
402
|
|
@@ -120,6 +120,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
120
120
|
else
|
121
121
|
stream_writer = body_stream
|
122
122
|
end
|
123
|
+
|
123
124
|
bulk_responses = []
|
124
125
|
batch_actions = []
|
125
126
|
bulk_actions.each_with_index do |action, index|
|
@@ -142,13 +143,16 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
142
143
|
stream_writer.write(as_json)
|
143
144
|
batch_actions << action
|
144
145
|
end
|
146
|
+
|
145
147
|
stream_writer.close if http_compression
|
148
|
+
|
146
149
|
logger.debug("Sending final bulk request for batch.",
|
147
150
|
:action_count => batch_actions.size,
|
148
151
|
:payload_size => stream_writer.pos,
|
149
152
|
:content_length => body_stream.size,
|
150
153
|
:batch_offset => (actions.size - batch_actions.size))
|
151
154
|
bulk_responses << bulk_send(body_stream, batch_actions) if body_stream.size > 0
|
155
|
+
|
152
156
|
body_stream.close if !http_compression
|
153
157
|
join_bulk_responses(bulk_responses)
|
154
158
|
end
|
@@ -367,36 +367,41 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
367
367
|
wait_for_successful_connection if @after_successful_connection_done
|
368
368
|
events_mapped = safe_interpolation_map_events(events)
|
369
369
|
retrying_submit(events_mapped.successful_events)
|
370
|
-
unless events_mapped.
|
371
|
-
|
372
|
-
send_failed_resolutions_to_dlq(events_mapped.failed_events)
|
370
|
+
unless events_mapped.event_mapping_errors.empty?
|
371
|
+
handle_event_mapping_errors(events_mapped.event_mapping_errors)
|
373
372
|
end
|
374
373
|
end
|
375
374
|
|
376
|
-
# @param: Arrays of
|
375
|
+
# @param: Arrays of FailedEventMapping
|
377
376
|
private
|
378
|
-
def
|
379
|
-
|
380
|
-
|
377
|
+
def handle_event_mapping_errors(event_mapping_errors)
|
378
|
+
# if DQL is enabled, log the events to provide issue insights to users.
|
379
|
+
if @dlq_writer
|
380
|
+
@logger.warn("Events could not be indexed and routing to DLQ, count: #{event_mapping_errors.size}")
|
381
381
|
end
|
382
|
+
|
383
|
+
event_mapping_errors.each do |event_mapping_error|
|
384
|
+
detailed_message = "#{event_mapping_error.message}; event: `#{event_mapping_error.event.to_hash_with_metadata}`"
|
385
|
+
handle_dlq_status(event_mapping_error.event, :warn, detailed_message)
|
386
|
+
end
|
387
|
+
@document_level_metrics.increment(:non_retryable_failures, event_mapping_errors.size)
|
382
388
|
end
|
383
389
|
|
384
|
-
MapEventsResult = Struct.new(:successful_events, :
|
390
|
+
MapEventsResult = Struct.new(:successful_events, :event_mapping_errors)
|
391
|
+
FailedEventMapping = Struct.new(:event, :message)
|
385
392
|
|
386
393
|
private
|
387
394
|
def safe_interpolation_map_events(events)
|
388
395
|
successful_events = [] # list of LogStash::Outputs::ElasticSearch::EventActionTuple
|
389
|
-
|
396
|
+
event_mapping_errors = [] # list of FailedEventMapping
|
390
397
|
events.each do |event|
|
391
|
-
|
398
|
+
begin
|
392
399
|
successful_events << @event_mapper.call(event)
|
393
|
-
|
394
|
-
|
395
|
-
event_action_tuple = EventActionTuple.new(action, [], event)
|
396
|
-
failed_events << event_action_tuple
|
400
|
+
rescue EventMappingError => ie
|
401
|
+
event_mapping_errors << FailedEventMapping.new(event, ie.message)
|
397
402
|
end
|
398
403
|
end
|
399
|
-
MapEventsResult.new(successful_events,
|
404
|
+
MapEventsResult.new(successful_events, event_mapping_errors)
|
400
405
|
end
|
401
406
|
|
402
407
|
public
|
@@ -449,6 +454,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
449
454
|
end
|
450
455
|
|
451
456
|
action = event.sprintf(@action || 'index')
|
457
|
+
raise UnsupportedActionError, action unless VALID_HTTP_ACTIONS.include?(action)
|
452
458
|
|
453
459
|
if action == 'update'
|
454
460
|
params[:_upsert] = LogStash::Json.load(event.sprintf(@upsert)) if @upsert != ""
|
@@ -476,13 +482,21 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
476
482
|
|
477
483
|
end
|
478
484
|
|
479
|
-
class
|
480
|
-
|
485
|
+
class EventMappingError < ArgumentError
|
486
|
+
def initialize(msg = nil)
|
487
|
+
super
|
488
|
+
end
|
489
|
+
end
|
481
490
|
|
491
|
+
class IndexInterpolationError < EventMappingError
|
482
492
|
def initialize(bad_formatted_index)
|
483
493
|
super("Badly formatted index, after interpolation still contains placeholder: [#{bad_formatted_index}]")
|
494
|
+
end
|
495
|
+
end
|
484
496
|
|
485
|
-
|
497
|
+
class UnsupportedActionError < EventMappingError
|
498
|
+
def initialize(bad_action)
|
499
|
+
super("Elasticsearch doesn't support [#{bad_action}] action")
|
486
500
|
end
|
487
501
|
end
|
488
502
|
|
@@ -214,13 +214,13 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
214
214
|
|
215
215
|
log_level = dig_value(response, 'index', 'error', 'type') == 'invalid_index_name_exception' ? :error : :warn
|
216
216
|
|
217
|
-
handle_dlq_status(action, log_level, detailed_message)
|
217
|
+
handle_dlq_status(action.event, log_level, detailed_message)
|
218
218
|
end
|
219
219
|
|
220
|
-
def handle_dlq_status(
|
220
|
+
def handle_dlq_status(event, log_level, message)
|
221
221
|
# To support bwc, we check if DLQ exists. otherwise we log and drop event (previous behavior)
|
222
222
|
if @dlq_writer
|
223
|
-
@dlq_writer.write(
|
223
|
+
@dlq_writer.write(event, "#{message}")
|
224
224
|
else
|
225
225
|
@logger.send log_level, message
|
226
226
|
end
|
@@ -259,7 +259,6 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
259
259
|
status = action_props["status"]
|
260
260
|
error = action_props["error"]
|
261
261
|
action = actions[idx]
|
262
|
-
action_params = action[1]
|
263
262
|
|
264
263
|
# Retry logic: If it is success, we move on. If it is a failure, we have 3 paths:
|
265
264
|
# - For 409, we log and drop. there is nothing we can do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '11.9.
|
3
|
+
s.version = '11.9.2'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Stores logs in Elasticsearch"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.add_development_dependency 'cabin', ['~> 0.6']
|
34
34
|
s.add_development_dependency 'webrick'
|
35
35
|
s.add_development_dependency 'webmock'
|
36
|
+
s.add_development_dependency 'rspec-collection_matchers'
|
36
37
|
# Still used in some specs, we should remove this ASAP
|
37
38
|
s.add_development_dependency 'elasticsearch'
|
38
39
|
end
|
@@ -137,7 +137,7 @@ describe "indexing with sprintf resolution", :integration => true do
|
|
137
137
|
before { subject.instance_variable_set('@dlq_writer', dlq_writer) }
|
138
138
|
|
139
139
|
it "should doesn't create an index name with unresolved placeholders" do
|
140
|
-
expect(dlq_writer).to receive(:write).once.with(event,
|
140
|
+
expect(dlq_writer).to receive(:write).once.with(event, a_string_including("Badly formatted index, after interpolation still contains placeholder"))
|
141
141
|
subject.multi_receive(events)
|
142
142
|
|
143
143
|
escaped_index_name = CGI.escape("%{[index_name]}_dynamic")
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require_relative "../../../spec/es_spec_helper"
|
2
|
+
|
3
|
+
describe "Unsupported actions testing...", :integration => true do
|
4
|
+
require "logstash/outputs/elasticsearch"
|
5
|
+
|
6
|
+
INDEX = "logstash-unsupported-actions-rejected"
|
7
|
+
|
8
|
+
def get_es_output( options={} )
|
9
|
+
settings = {
|
10
|
+
"manage_template" => true,
|
11
|
+
"index" => INDEX,
|
12
|
+
"template_overwrite" => true,
|
13
|
+
"hosts" => get_host_port(),
|
14
|
+
"action" => "%{action_field}",
|
15
|
+
"document_id" => "%{doc_id}",
|
16
|
+
"ecs_compatibility" => "disabled"
|
17
|
+
}
|
18
|
+
LogStash::Outputs::ElasticSearch.new(settings.merge!(options))
|
19
|
+
end
|
20
|
+
|
21
|
+
before :each do
|
22
|
+
@es = get_client
|
23
|
+
# Delete all templates first.
|
24
|
+
# Clean ES of data before we start.
|
25
|
+
@es.indices.delete_template(:name => "*")
|
26
|
+
# This can fail if there are no indexes, ignore failure.
|
27
|
+
@es.indices.delete(:index => "*") rescue nil
|
28
|
+
# index single doc for update purpose
|
29
|
+
@es.index(
|
30
|
+
:index => INDEX,
|
31
|
+
:type => doc_type,
|
32
|
+
:id => "2",
|
33
|
+
:body => { :message => 'Test to doc indexing', :counter => 1 }
|
34
|
+
)
|
35
|
+
@es.index(
|
36
|
+
:index => INDEX,
|
37
|
+
:type => doc_type,
|
38
|
+
:id => "3",
|
39
|
+
:body => { :message => 'Test to doc deletion', :counter => 2 }
|
40
|
+
)
|
41
|
+
@es.indices.refresh
|
42
|
+
end
|
43
|
+
|
44
|
+
context "multiple actions include unsupported action" do
|
45
|
+
let(:events) {[
|
46
|
+
LogStash::Event.new("action_field" => "index", "doc_id" => 1, "message"=> "hello"),
|
47
|
+
LogStash::Event.new("action_field" => "update", "doc_id" => 2, "message"=> "hi"),
|
48
|
+
LogStash::Event.new("action_field" => "delete", "doc_id" => 3),
|
49
|
+
LogStash::Event.new("action_field" => "unsupported_action", "doc_id" => 4, "message"=> "world!")
|
50
|
+
]}
|
51
|
+
|
52
|
+
it "should reject unsupported doc" do
|
53
|
+
subject = get_es_output
|
54
|
+
subject.register
|
55
|
+
subject.multi_receive(events)
|
56
|
+
|
57
|
+
index_or_update = proc do |event|
|
58
|
+
action = event.get("action_field")
|
59
|
+
action.eql?("index") || action.eql?("update")
|
60
|
+
end
|
61
|
+
|
62
|
+
indexed_events = events.select { |event| index_or_update.call(event) }
|
63
|
+
rejected_events = events.select { |event| !index_or_update.call(event) }
|
64
|
+
|
65
|
+
indexed_events.each do |event|
|
66
|
+
response = @es.get(:index => INDEX, :type => doc_type, :id => event.get("doc_id"), :refresh => true)
|
67
|
+
expect(response['_source']['message']).to eq(event.get("message"))
|
68
|
+
end
|
69
|
+
|
70
|
+
rejected_events.each do |event|
|
71
|
+
expect {@es.get(:index => INDEX, :type => doc_type, :id => event.get("doc_id"), :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -3,8 +3,8 @@ require "base64"
|
|
3
3
|
require "flores/random"
|
4
4
|
require 'concurrent/atomic/count_down_latch'
|
5
5
|
require "logstash/outputs/elasticsearch"
|
6
|
-
|
7
6
|
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
|
7
|
+
require 'rspec/collection_matchers'
|
8
8
|
|
9
9
|
describe LogStash::Outputs::ElasticSearch do
|
10
10
|
subject(:elasticsearch_output_instance) { described_class.new(options) }
|
@@ -347,7 +347,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
347
347
|
}
|
348
348
|
},
|
349
349
|
# NOTE: this is an artificial success (usually everything fails with a 500) but even if some doc where
|
350
|
-
# to succeed due the unexpected
|
350
|
+
# to succeed due the unexpected response items we can not clearly identify which actions to retry ...
|
351
351
|
{"index"=>{"_index"=>"bar2", "_type"=>"_doc", "_id"=>nil, "status"=>201}},
|
352
352
|
{"index"=>{"_index"=>"bar2", "_type"=>"_doc", "_id"=>nil, "status"=>500,
|
353
353
|
"error"=>{"type" => "illegal_state_exception",
|
@@ -381,6 +381,104 @@ describe LogStash::Outputs::ElasticSearch do
|
|
381
381
|
subject.multi_receive(events)
|
382
382
|
end
|
383
383
|
end
|
384
|
+
|
385
|
+
context "unsupported actions" do
|
386
|
+
let(:options) { super().merge("index" => "logstash", "action" => "%{action_field}") }
|
387
|
+
|
388
|
+
context "with multiple valid actions with one trailing invalid action" do
|
389
|
+
let(:events) {[
|
390
|
+
LogStash::Event.new("action_field" => "index", "id" => 1, "message"=> "hello"),
|
391
|
+
LogStash::Event.new("action_field" => "index", "id" => 2, "message"=> "hi"),
|
392
|
+
LogStash::Event.new("action_field" => "index", "id" => 3, "message"=> "bye"),
|
393
|
+
LogStash::Event.new("action_field" => "unsupported_action", "id" => 4, "message"=> "world!")
|
394
|
+
]}
|
395
|
+
it "rejects unsupported actions" do
|
396
|
+
event_result = subject.send(:safe_interpolation_map_events, events)
|
397
|
+
expect(event_result.successful_events).to have_exactly(3).items
|
398
|
+
event_result.successful_events.each do |action, _|
|
399
|
+
expect(action).to_not eql("unsupported_action")
|
400
|
+
end
|
401
|
+
expect(event_result.event_mapping_errors).to have_exactly(1).items
|
402
|
+
event_result.event_mapping_errors.each do |event_mapping_error|
|
403
|
+
expect(event_mapping_error.message).to eql("Elasticsearch doesn't support [unsupported_action] action")
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
context "with one leading invalid action followed by multiple valid actions" do
|
409
|
+
let(:events) {[
|
410
|
+
LogStash::Event.new("action_field" => "unsupported_action", "id" => 1, "message"=> "world!"),
|
411
|
+
LogStash::Event.new("action_field" => "index", "id" => 2, "message"=> "hello"),
|
412
|
+
LogStash::Event.new("action_field" => "index", "id" => 3, "message"=> "hi"),
|
413
|
+
LogStash::Event.new("action_field" => "index", "id" => 4, "message"=> "bye")
|
414
|
+
]}
|
415
|
+
it "rejects unsupported actions" do
|
416
|
+
event_result = subject.send(:safe_interpolation_map_events, events)
|
417
|
+
expect(event_result.successful_events).to have_exactly(3).items
|
418
|
+
event_result.successful_events.each do |action, _|
|
419
|
+
expect(action).to_not eql("unsupported_action")
|
420
|
+
end
|
421
|
+
expect(event_result.event_mapping_errors).to have_exactly(1).items
|
422
|
+
event_result.event_mapping_errors.each do |event_mapping_error|
|
423
|
+
expect(event_mapping_error.message).to eql("Elasticsearch doesn't support [unsupported_action] action")
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
context "with batch of multiple invalid actions and no valid actions" do
|
429
|
+
let(:events) {[
|
430
|
+
LogStash::Event.new("action_field" => "unsupported_action1", "id" => 1, "message"=> "world!"),
|
431
|
+
LogStash::Event.new("action_field" => "unsupported_action2", "id" => 2, "message"=> "hello"),
|
432
|
+
LogStash::Event.new("action_field" => "unsupported_action3", "id" => 3, "message"=> "hi"),
|
433
|
+
LogStash::Event.new("action_field" => "unsupported_action4", "id" => 4, "message"=> "bye")
|
434
|
+
]}
|
435
|
+
it "rejects unsupported actions" do
|
436
|
+
event_result = subject.send(:safe_interpolation_map_events, events)
|
437
|
+
expect(event_result.successful_events).to have(:no).items
|
438
|
+
event_result.successful_events.each do |action, _|
|
439
|
+
expect(action).to_not eql("unsupported_action")
|
440
|
+
end
|
441
|
+
expect(event_result.event_mapping_errors).to have_exactly(4).items
|
442
|
+
event_result.event_mapping_errors.each do |event_mapping_error|
|
443
|
+
expect(event_mapping_error.message).to include "Elasticsearch doesn't support"
|
444
|
+
end
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
context "with batch of intermixed valid and invalid actions" do
|
449
|
+
let(:events) {[
|
450
|
+
LogStash::Event.new("action_field" => "index", "id" => 1, "message"=> "world!"),
|
451
|
+
LogStash::Event.new("action_field" => "unsupported_action2", "id" => 2, "message"=> "hello"),
|
452
|
+
LogStash::Event.new("action_field" => "unsupported_action3", "id" => 3, "message"=> "hi"),
|
453
|
+
LogStash::Event.new("action_field" => "index", "id" => 4, "message"=> "bye")
|
454
|
+
]}
|
455
|
+
it "rejects unsupported actions" do
|
456
|
+
event_result = subject.send(:safe_interpolation_map_events, events)
|
457
|
+
expect(event_result.successful_events).to have_exactly(2).items
|
458
|
+
expect(event_result.event_mapping_errors).to have_exactly(2).items
|
459
|
+
event_result.event_mapping_errors.each do |event_mapping_error|
|
460
|
+
expect(event_mapping_error.message).to include "Elasticsearch doesn't support"
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|
464
|
+
|
465
|
+
context "with batch of exactly one action that is invalid" do
|
466
|
+
let(:events) {[
|
467
|
+
LogStash::Event.new("action_field" => "index", "id" => 1, "message"=> "world!"),
|
468
|
+
LogStash::Event.new("action_field" => "index", "id" => 2, "message"=> "hello"),
|
469
|
+
LogStash::Event.new("action_field" => "unsupported_action3", "id" => 3, "message"=> "hi"),
|
470
|
+
LogStash::Event.new("action_field" => "index", "id" => 4, "message"=> "bye")
|
471
|
+
]}
|
472
|
+
it "rejects unsupported action" do
|
473
|
+
event_result = subject.send(:safe_interpolation_map_events, events)
|
474
|
+
expect(event_result.successful_events).to have_exactly(3).items
|
475
|
+
expect(event_result.event_mapping_errors).to have_exactly(1).items
|
476
|
+
event_result.event_mapping_errors.each do |event_mapping_error|
|
477
|
+
expect(event_mapping_error.message).to eql("Elasticsearch doesn't support [unsupported_action3] action")
|
478
|
+
end
|
479
|
+
end
|
480
|
+
end
|
481
|
+
end
|
384
482
|
end
|
385
483
|
|
386
484
|
context '413 errors' do
|
@@ -772,6 +870,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
772
870
|
|
773
871
|
context 'when @dlq_writer is nil' do
|
774
872
|
before { subject.instance_variable_set '@dlq_writer', nil }
|
873
|
+
let(:action) { LogStash::Outputs::ElasticSearch::EventActionTuple.new(:action, :params, LogStash::Event.new("foo" => "bar")) }
|
775
874
|
|
776
875
|
context 'resorting to previous behaviour of logging the error' do
|
777
876
|
context 'getting an invalid_index_name_exception' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.9.
|
4
|
+
version: 11.9.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,6 +196,20 @@ dependencies:
|
|
196
196
|
- - ">="
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
|
+
- !ruby/object:Gem::Dependency
|
200
|
+
requirement: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
name: rspec-collection_matchers
|
206
|
+
prerelease: false
|
207
|
+
type: :development
|
208
|
+
version_requirements: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
199
213
|
- !ruby/object:Gem::Dependency
|
200
214
|
requirement: !ruby/object:Gem::Requirement
|
201
215
|
requirements:
|
@@ -288,6 +302,7 @@ files:
|
|
288
302
|
- spec/integration/outputs/routing_spec.rb
|
289
303
|
- spec/integration/outputs/sniffer_spec.rb
|
290
304
|
- spec/integration/outputs/templates_spec.rb
|
305
|
+
- spec/integration/outputs/unsupported_actions_spec.rb
|
291
306
|
- spec/integration/outputs/update_spec.rb
|
292
307
|
- spec/spec_helper.rb
|
293
308
|
- spec/support/elasticsearch/api/actions/delete_ilm_policy.rb
|
@@ -373,6 +388,7 @@ test_files:
|
|
373
388
|
- spec/integration/outputs/routing_spec.rb
|
374
389
|
- spec/integration/outputs/sniffer_spec.rb
|
375
390
|
- spec/integration/outputs/templates_spec.rb
|
391
|
+
- spec/integration/outputs/unsupported_actions_spec.rb
|
376
392
|
- spec/integration/outputs/update_spec.rb
|
377
393
|
- spec/spec_helper.rb
|
378
394
|
- spec/support/elasticsearch/api/actions/delete_ilm_policy.rb
|