logstash-output-elasticsearch 11.12.3-java → 11.12.4-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: a71925d993ccbf151c0cb88f41641e76926df0a2a398914dbe5d4ce54224c8f5
4
- data.tar.gz: 97b17aad17959c0319ce94916570ce12f9ef67b7a22d583221ac26688e7cbe76
3
+ metadata.gz: a912267d383b51082d4c1b68e21d83dcb506433abc4f3f12bce0465eef84f439
4
+ data.tar.gz: dc69623c94ad47986ed07f25818eeabfbfdd49532dfd9970f8c638dfe950f615
5
5
  SHA512:
6
- metadata.gz: '0817002e4b468d47ea5540e8a9ed63efbee2506350da2f08a3171d0e26037a4e99d5bff613f6f6fca91ea441c88ae08602b211a656e10f13f5b9a91895838bab'
7
- data.tar.gz: 60312f326a381d28b895c8f1f7f8fae611d7fdb1ccf4f1782da15949eb84c2fb93411e998f727ba91a922052cfe785bb9a3227aa798c7e1434eeca8369024471
6
+ metadata.gz: 99568149dc8d313460046ca2e247c43e2e505e6649441a22a365e0d5484ba493d5d91c4eedfb5700fc447f64122555db3b92d6b59513a6b42e07dcc43dda3ada
7
+ data.tar.gz: 56d2ce9c942f2dffbfc850f8feec0368dc2456ee08f7d7f46b83de94f9439fdd9047a1bae9231cc41caf45105a1abda0d1e60429a37059709f337e5ea8f8b6e4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 11.12.4
2
+ - Changed the `manage_template` default value to `false` when data streams is enabled [#1111](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1111)
3
+ - Added the `manage_template => false` as a valid data stream option
4
+
1
5
  ## 11.12.3
2
6
  - Changed the log messages for data stream checks [#1109](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1109)
3
7
  - 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>>
@@ -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
@@ -608,6 +612,13 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
608
612
  @template_name ||= default_template_name
609
613
  end
610
614
 
615
+ def setup_template_manager_defaults(data_stream_enabled)
616
+ if original_params["manage_template"].nil? && data_stream_enabled
617
+ logger.debug("Disabling template management since data streams are enabled")
618
+ @manage_template = false
619
+ end
620
+ end
621
+
611
622
  # To be overidden by the -java version
612
623
  VALID_HTTP_ACTIONS = ["index", "delete", "create", "update"]
613
624
  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.12.3'
3
+ s.version = '11.12.4'
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
@@ -606,6 +606,26 @@ describe LogStash::Outputs::ElasticSearch do
606
606
  end
607
607
  end
608
608
 
609
+ describe "the manage_template option" do
610
+ context "with data stream enabled" do
611
+ let(:options) { {"data_stream" => "true", "data_stream_type" => "logs" } }
612
+ let(:do_register) { true }
613
+
614
+ it "should default to false" do
615
+ expect(subject).to have_attributes(manage_template: false)
616
+ end
617
+ end
618
+
619
+ context "with data stream disabled" do
620
+ let(:options) { {"data_stream" => "false", "index" => "logs" } }
621
+ let(:do_register) { true }
622
+
623
+ it "should default to true" do
624
+ expect(subject).to have_attributes(manage_template: true)
625
+ end
626
+ end
627
+ end
628
+
609
629
  describe "SSL end to end" do
610
630
  let(:do_register) { false } # skip the register in the global before block, as is called here.
611
631
 
@@ -870,7 +890,7 @@ describe LogStash::Outputs::ElasticSearch do
870
890
  end if LOGSTASH_VERSION > '6.0'
871
891
 
872
892
  context 'handling elasticsearch document-level status meant for the DLQ' do
873
- let(:options) { { "manage_template" => false } }
893
+ let(:options) { { "manage_template" => false, "data_stream" => 'false' } }
874
894
  let(:action) { LogStash::Outputs::ElasticSearch::EventActionTuple.new(:action, :params, LogStash::Event.new("foo" => "bar")) }
875
895
 
876
896
  context 'when @dlq_writer is nil' do
@@ -1140,7 +1160,7 @@ describe LogStash::Outputs::ElasticSearch do
1140
1160
  describe "post-register ES setup" do
1141
1161
  let(:do_register) { false }
1142
1162
  let(:es_version) { '7.10.0' } # DS default on LS 8.x
1143
- let(:options) { { 'hosts' => '127.0.0.1:9999' } }
1163
+ let(:options) { { 'hosts' => '127.0.0.1:9999', 'data_stream' => 'false' } }
1144
1164
  let(:logger) { subject.logger }
1145
1165
 
1146
1166
  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.12.3
4
+ version: 11.12.4
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement