logstash-output-elasticsearch 11.12.3-java → 11.13.0-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 +7 -0
- data/docs/index.asciidoc +4 -5
- data/lib/logstash/outputs/elasticsearch/data_stream_support.rb +2 -1
- data/lib/logstash/outputs/elasticsearch.rb +23 -9
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +33 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +83 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e8764e50f36193ca77db2e6abe008e64732e52fd102554d6325d53180041ca6
|
4
|
+
data.tar.gz: 8e2525721fdf4a3e82c5983ea815125c407b91ab7e57e18d11256346c54d02c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4c7059810d99d9aaa5d36a06a87eaf771ab1472056f8ed4bc7b05dfaf9280b6cc1a02a623bd1f5d25b7bb2f6458310450ebef91d8301757f8759512d1da625
|
7
|
+
data.tar.gz: e0970b2d8fc1413bcc7ab25bb02393f8be1ffe12fa0bf6c2349ad6ba3790ee844cfcf42136b0c10ea1b46e2c3bd2238da7a285869255076da28ba47ab6d84f9d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 11.13.0
|
2
|
+
- add technology preview support for allowing events to individually encode a default pipeline with `[@metadata][target_ingest_pipeline]` (as part of a technology preview, this feature may change without notice) [#1113](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1113)
|
3
|
+
|
4
|
+
## 11.12.4
|
5
|
+
- Changed the `manage_template` default value to `false` when data streams is enabled [#1111](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1111)
|
6
|
+
- Added the `manage_template => false` as a valid data stream option
|
7
|
+
|
1
8
|
## 11.12.3
|
2
9
|
- Changed the log messages for data stream checks [#1109](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1109)
|
3
10
|
- Added more details about incompatible data streams supplied configurations
|
data/docs/index.asciidoc
CHANGED
@@ -790,7 +790,7 @@ Set the keystore password
|
|
790
790
|
===== `manage_template`
|
791
791
|
|
792
792
|
* Value type is <<boolean,boolean>>
|
793
|
-
* Default value is `true`
|
793
|
+
* Default value is `true` for non-time series data, and `false` for data streams.
|
794
794
|
|
795
795
|
From Logstash 1.3 onwards, a template is applied to Elasticsearch during
|
796
796
|
Logstash's startup if one with the name <<plugins-{type}s-{plugin}-template_name>>
|
@@ -849,12 +849,11 @@ not also set this field. That will raise an error at startup
|
|
849
849
|
===== `pipeline`
|
850
850
|
|
851
851
|
* Value type is <<string,string>>
|
852
|
-
*
|
852
|
+
* There is no default value.
|
853
853
|
|
854
854
|
Set which ingest pipeline you wish to execute for an event. You can also use
|
855
|
-
event dependent configuration here like `pipeline =>
|
856
|
-
|
857
|
-
resolves to empty string ("").
|
855
|
+
event dependent configuration here like `pipeline => "%{[@metadata][pipeline]}"`.
|
856
|
+
The pipeline parameter won't be set if the value resolves to empty string ("").
|
858
857
|
|
859
858
|
[id="plugins-{type}s-{plugin}-pool_max"]
|
860
859
|
===== `pool_max`
|
@@ -118,7 +118,6 @@ module LogStash module Outputs class ElasticSearch
|
|
118
118
|
params.reject do |name, value|
|
119
119
|
# NOTE: intentionally do not support explicit DS configuration like:
|
120
120
|
# - `index => ...` identifier provided by data_stream_xxx settings
|
121
|
-
# - `manage_template => false` implied by not setting the parameter
|
122
121
|
case name
|
123
122
|
when 'action'
|
124
123
|
value == 'create'
|
@@ -126,6 +125,8 @@ module LogStash module Outputs class ElasticSearch
|
|
126
125
|
true
|
127
126
|
when 'data_stream'
|
128
127
|
value.to_s == 'true'
|
128
|
+
when 'manage_template'
|
129
|
+
value.to_s == 'false'
|
129
130
|
when 'ecs_compatibility' then true # required for LS <= 6.x
|
130
131
|
else
|
131
132
|
name.start_with?('data_stream_') ||
|
@@ -158,6 +158,8 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
158
158
|
# control over template creation, (e.g. creating indices dynamically based on
|
159
159
|
# field names) you should set `manage_template` to false and use the REST
|
160
160
|
# API to apply your templates manually.
|
161
|
+
#
|
162
|
+
# Default value is `true` unless data streams is enabled
|
161
163
|
config :manage_template, :validate => :boolean, :default => true
|
162
164
|
|
163
165
|
# This configuration option defines how the template is named inside Elasticsearch.
|
@@ -304,6 +306,8 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
304
306
|
# It's being concurrently invoked by this register method and by the finish_register on the @after_successful_connection_thread
|
305
307
|
data_stream_enabled = data_stream_config?
|
306
308
|
|
309
|
+
setup_template_manager_defaults(data_stream_enabled)
|
310
|
+
|
307
311
|
@after_successful_connection_thread = after_successful_connection do
|
308
312
|
begin
|
309
313
|
finish_register
|
@@ -520,19 +524,22 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
520
524
|
routing_field_name => @routing ? event.sprintf(@routing) : nil
|
521
525
|
}
|
522
526
|
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
params[:pipeline] = value unless value.empty?
|
531
|
-
end
|
527
|
+
target_pipeline = resolve_pipeline(event)
|
528
|
+
# convention: empty string equates to not using a pipeline
|
529
|
+
# this is useful when using a field reference in the pipeline setting, e.g.
|
530
|
+
# elasticsearch {
|
531
|
+
# pipeline => "%{[@metadata][pipeline]}"
|
532
|
+
# }
|
533
|
+
params[:pipeline] = target_pipeline unless (target_pipeline.nil? || target_pipeline.empty?)
|
532
534
|
|
533
535
|
params
|
534
536
|
end
|
535
537
|
|
538
|
+
def resolve_pipeline(event)
|
539
|
+
pipeline_template = @pipeline || event.get("[@metadata][target_ingest_pipeline]")&.to_s
|
540
|
+
pipeline_template && event.sprintf(pipeline_template)
|
541
|
+
end
|
542
|
+
|
536
543
|
@@plugins = Gem::Specification.find_all{|spec| spec.name =~ /logstash-output-elasticsearch-/ }
|
537
544
|
|
538
545
|
@@plugins.each do |plugin|
|
@@ -608,6 +615,13 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
608
615
|
@template_name ||= default_template_name
|
609
616
|
end
|
610
617
|
|
618
|
+
def setup_template_manager_defaults(data_stream_enabled)
|
619
|
+
if original_params["manage_template"].nil? && data_stream_enabled
|
620
|
+
logger.debug("Disabling template management since data streams are enabled")
|
621
|
+
@manage_template = false
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
611
625
|
# To be overidden by the -java version
|
612
626
|
VALID_HTTP_ACTIONS = ["index", "delete", "create", "update"]
|
613
627
|
def valid_actions
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '11.
|
3
|
+
s.version = '11.13.0'
|
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"
|
@@ -152,6 +152,39 @@ describe LogStash::Outputs::ElasticSearch::DataStreamSupport do
|
|
152
152
|
|
153
153
|
end
|
154
154
|
|
155
|
+
context 'ds value-dependent configuration' do
|
156
|
+
context 'with valid values' do
|
157
|
+
let(:options) { super().merge(
|
158
|
+
'action' => 'create',
|
159
|
+
'routing' => 'any',
|
160
|
+
'pipeline' => 'any',
|
161
|
+
'manage_template' => 'false',
|
162
|
+
'data_stream' => 'true',
|
163
|
+
'data_stream_type' => 'logs',
|
164
|
+
'data_stream_dataset' => 'any',
|
165
|
+
'data_stream_namespace' => 'any',
|
166
|
+
'data_stream_sync_fields' => true,
|
167
|
+
'data_stream_auto_routing' => true)
|
168
|
+
}
|
169
|
+
|
170
|
+
it 'should enable data-streams by default' do
|
171
|
+
expect( subject.data_stream_config? ).to be_truthy
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'with invalid values' do
|
176
|
+
let(:options) { super().merge(
|
177
|
+
'data_stream' => 'true',
|
178
|
+
'action' => 'index',
|
179
|
+
'manage_template' => 'true')
|
180
|
+
}
|
181
|
+
|
182
|
+
it 'should raise a configuration error' do
|
183
|
+
expect { subject.data_stream_config? }.to raise_error(LogStash::ConfigurationError, 'Invalid data stream configuration: ["action", "manage_template"]')
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
155
188
|
context "default (non data-stream) configuration (on 7.x)" do
|
156
189
|
|
157
190
|
let(:options) do
|
@@ -590,7 +590,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
590
590
|
|
591
591
|
let(:event) { LogStash::Event.new("pipeline" => "my-ingest-pipeline") }
|
592
592
|
|
593
|
-
it "
|
593
|
+
it "interpolate the pipeline value and set it" do
|
594
594
|
expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "my-ingest-pipeline")
|
595
595
|
end
|
596
596
|
end
|
@@ -600,10 +600,89 @@ describe LogStash::Outputs::ElasticSearch do
|
|
600
600
|
|
601
601
|
let(:event) { LogStash::Event.new("pipeline" => "") }
|
602
602
|
|
603
|
-
it "
|
603
|
+
it "interpolates the pipeline value but not set it because it is empty" do
|
604
604
|
expect(subject.send(:event_action_tuple, event)[1]).not_to include(:pipeline)
|
605
605
|
end
|
606
606
|
end
|
607
|
+
|
608
|
+
context "with both pipeline and target_ingest_pipeline" do
|
609
|
+
let(:options) { {"pipeline" => "%{pipeline}" } }
|
610
|
+
let(:event) { LogStash::Event.new({"pipeline" => "my-ingest-pipeline", "[@metadata][target_ingest_pipeline]" => "meta-ingest-pipeline"}) }
|
611
|
+
|
612
|
+
it "interpolates the plugin's pipeline value" do
|
613
|
+
expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "my-ingest-pipeline")
|
614
|
+
end
|
615
|
+
|
616
|
+
context "when the plugin's `pipeline` is constant" do
|
617
|
+
let(:options) { super().merge("pipeline" => "my-constant-pipeline") }
|
618
|
+
it "uses plugin's pipeline value" do
|
619
|
+
expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "my-constant-pipeline")
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
623
|
+
context "when the plugin's `pipeline` includes an unresolvable sprintf placeholder" do
|
624
|
+
let(:options) { super().merge("pipeline" => "reference-%{unset}-field") }
|
625
|
+
it "does not use the target_ingest_pipeline" do
|
626
|
+
# when sprintf doesn't resolve a placeholder, the behaviour of our `pipeline` is UNSPECIFIED.
|
627
|
+
# here we only validate that the presence of the magic field does not
|
628
|
+
# override an explicitly-configured pipeline.
|
629
|
+
expect(subject.send(:event_action_tuple, event)[1]).to_not include(:pipeline => "my-ingest-pipeline")
|
630
|
+
end
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
634
|
+
context "with empty pipeline and target_ingest_pipeline" do
|
635
|
+
let(:options) { {"pipeline" => "%{pipeline}" } }
|
636
|
+
let(:event) { LogStash::Event.new({"pipeline" => "", "[@metadata][target_ingest_pipeline]" => "meta-ingest-pipeline"}) }
|
637
|
+
|
638
|
+
it "interpolates the pipeline value but not set it because pipeline is empty" do
|
639
|
+
expect(subject.send(:event_action_tuple, event)[1]).not_to include(:pipeline)
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
context "with target_ingest_pipeline" do
|
644
|
+
let(:event) { LogStash::Event.new({"pipeline" => "", "@metadata" => {"target_ingest_pipeline" => "meta-ingest-pipeline"}}) }
|
645
|
+
|
646
|
+
it "interpolates the target_ingest_pipeline value and set it" do
|
647
|
+
expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "meta-ingest-pipeline")
|
648
|
+
end
|
649
|
+
end
|
650
|
+
|
651
|
+
context "with empty target_ingest_pipeline" do
|
652
|
+
let(:event) { LogStash::Event.new({"pipeline" => "", "@metadata" => {"host" => "elastic"}}) }
|
653
|
+
|
654
|
+
it "does not set pipeline" do
|
655
|
+
expect(subject.send(:event_action_tuple, event)[1]).not_to include(:pipeline)
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
context "with empty pipeline and empty target_ingest_pipeline" do
|
660
|
+
let(:event) { LogStash::Event.new }
|
661
|
+
|
662
|
+
it "does not set pipeline" do
|
663
|
+
expect(subject.send(:event_action_tuple, event)[1]).not_to include(:pipeline)
|
664
|
+
end
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
describe "the manage_template option" do
|
669
|
+
context "with data stream enabled" do
|
670
|
+
let(:options) { {"data_stream" => "true", "data_stream_type" => "logs" } }
|
671
|
+
let(:do_register) { true }
|
672
|
+
|
673
|
+
it "should default to false" do
|
674
|
+
expect(subject).to have_attributes(manage_template: false)
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
678
|
+
context "with data stream disabled" do
|
679
|
+
let(:options) { {"data_stream" => "false", "index" => "logs" } }
|
680
|
+
let(:do_register) { true }
|
681
|
+
|
682
|
+
it "should default to true" do
|
683
|
+
expect(subject).to have_attributes(manage_template: true)
|
684
|
+
end
|
685
|
+
end
|
607
686
|
end
|
608
687
|
|
609
688
|
describe "SSL end to end" do
|
@@ -870,7 +949,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
870
949
|
end if LOGSTASH_VERSION > '6.0'
|
871
950
|
|
872
951
|
context 'handling elasticsearch document-level status meant for the DLQ' do
|
873
|
-
let(:options) { { "manage_template" => false } }
|
952
|
+
let(:options) { { "manage_template" => false, "data_stream" => 'false' } }
|
874
953
|
let(:action) { LogStash::Outputs::ElasticSearch::EventActionTuple.new(:action, :params, LogStash::Event.new("foo" => "bar")) }
|
875
954
|
|
876
955
|
context 'when @dlq_writer is nil' do
|
@@ -1140,7 +1219,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
1140
1219
|
describe "post-register ES setup" do
|
1141
1220
|
let(:do_register) { false }
|
1142
1221
|
let(:es_version) { '7.10.0' } # DS default on LS 8.x
|
1143
|
-
let(:options) { { 'hosts' => '127.0.0.1:9999' } }
|
1222
|
+
let(:options) { { 'hosts' => '127.0.0.1:9999', 'data_stream' => 'false' } }
|
1144
1223
|
let(:logger) { subject.logger }
|
1145
1224
|
|
1146
1225
|
before 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.
|
4
|
+
version: 11.13.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-
|
11
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|