fluent-plugin-elasticsearch 5.4.4 → 6.0.0

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: 5808f1d08b2a774e67ea22cbf9b678100a1a630c22f6d27ed4c2c656b396f32c
4
- data.tar.gz: 836d9697ba68a2b86875429abd31fd09b8d4533d26b2dab4ede5ebdf64a9aad7
3
+ metadata.gz: b54470881e62c1a0c6fccc56867faf07ecbe210a0926a8073fc646fcd2ffc9e1
4
+ data.tar.gz: f973db55d17915664f6cb59676738c62f7408c3d94734cdb54b76025d62d82c8
5
5
  SHA512:
6
- metadata.gz: 3c349e163f308a421d5bc7f74f170def2a1b3845650680b93479a01fcdcd32b2a89dfcb49903ca6c3eaea041beb9dcead4ce5735189f83aa95f9151c2ce3433a
7
- data.tar.gz: 0cb7d133409a0289a00fd3e09e9447ac92a3ab72d74cefe92e191477e3bbba0673a322448d8828bb0adc37fcb6f7c523469ec9a95273a5a86fade6fb0dc9cdc8
6
+ metadata.gz: 45a60caf34b6e02e5e2a46fd02535a3fa1648d1feb712c1d20c1a88f041c29a39fe688afba1c88511a572075db7e98c767ad81b4197b6bc56a1e1e27d9149764
7
+ data.tar.gz: 2e0d0dab94d7c3112b637f185c9df0bf16c2fb1805d9186de2fecf6d25e66eea269482431b2db20b62e66f16ebcbd66dd576d6e1e957c12c29d68728b7132806
data/History.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 6.0.0
6
+ - Adjust Content-Type and Accept headers for sending logs into ES9 (#1064)
7
+
5
8
  ### 5.4.4
6
9
  - docs: Clarify README docs for template_name and templates (#1043)
7
10
  - `out_elasticsearch_data_stream`: Avoid long worrying log line at info level (#1044)
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'fluent-plugin-elasticsearch'
6
- s.version = '5.4.4'
6
+ s.version = '6.0.0'
7
7
  s.authors = ['diogo', 'pitr', 'Hiroshi Hatake']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com', 'cosmo0920.wp@gmail.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -73,6 +73,7 @@ module Fluent::Plugin
73
73
  DEFAULT_RELOAD_AFTER = -1
74
74
  DEFAULT_TARGET_BULK_BYTES = -1
75
75
  DEFAULT_POLICY_ID = "logstash-policy"
76
+ ES9_CONTENT_TYPE = "application/vnd.elasticsearch+x-ndjson; compatible-with=9"
76
77
 
77
78
  config_param :host, :string, :default => 'localhost'
78
79
  config_param :port, :integer, :default => 9200
@@ -350,10 +351,22 @@ EOC
350
351
  log.warn "Detected ES 7.x: `_doc` will be used as the document `_type`."
351
352
  @type_name = '_doc'.freeze
352
353
  end
353
- if @last_seen_major_version >= 8 && @type_name != DEFAULT_TYPE_NAME_ES_7x
354
- log.debug "Detected ES 8.x or above: This parameter has no effect."
354
+ if @last_seen_major_version == 8 && @type_name != DEFAULT_TYPE_NAME_ES_7x
355
+ log.debug "Detected ES 8.x: This parameter has no effect."
355
356
  @type_name = nil
356
357
  end
358
+ if @last_seen_major_version >= 9
359
+ if @type_name != DEFAULT_TYPE_NAME_ES_7x
360
+ log.debug "Detected ES 9.x or above: This parameter has no effect."
361
+ @type_name = nil
362
+ end
363
+ @accept_type = nil
364
+ if @content_type != ES9_CONTENT_TYPE
365
+ log.trace "Detected ES 9.x or above: Content-Type will be adjusted."
366
+ @content_type = ES9_CONTENT_TYPE
367
+ @accept_type = ES9_CONTENT_TYPE
368
+ end
369
+ end
357
370
  end
358
371
 
359
372
  if @validate_client_version && !dry_run?
@@ -614,6 +627,8 @@ EOC
614
627
  .merge(@custom_headers)
615
628
  .merge(@api_key_header)
616
629
  .merge(gzip_headers)
630
+ headers.merge!('Accept' => @accept_type) if @accept_type
631
+
617
632
  ssl_options = { verify: @ssl_verify, ca_file: @ca_file}.merge(@ssl_version_options)
618
633
 
619
634
  transport = TRANSPORT_CLASS::Transport::HTTP::Faraday.new(connection_options.merge(
@@ -90,7 +90,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
90
90
  end
91
91
 
92
92
  def stub_elastic(url="http://localhost:9200/_bulk")
93
- stub_request(:post, url).with do |req|
93
+ headers = if elasticsearch_miscellaneous_content_type?
94
+ { "Content-Type" => "application/vnd.elasticsearch+x-ndjson; compatible-with=9" }
95
+ else
96
+ {}
97
+ end
98
+
99
+ stub_request(:post, url).with({headers: headers}) do |req|
94
100
  @index_cmds = req.body.split("\n").map {|r| JSON.parse(r) }
95
101
  end.to_return({:status => 200, :body => "", :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } })
96
102
  end
@@ -4016,6 +4022,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
4016
4022
  data('Elasticsearch 6' => [6, Fluent::Plugin::ElasticsearchOutput::DEFAULT_TYPE_NAME],
4017
4023
  'Elasticsearch 7' => [7, Fluent::Plugin::ElasticsearchOutput::DEFAULT_TYPE_NAME_ES_7x],
4018
4024
  'Elasticsearch 8' => [8, nil],
4025
+ 'Elasticsearch 9' => [9, nil],
4019
4026
  )
4020
4027
  def test_writes_to_default_type(data)
4021
4028
  version, index_type = data
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.4
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
8
8
  - pitr
9
9
  - Hiroshi Hatake
10
+ autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 1980-01-02 00:00:00.000000000 Z
13
+ date: 2025-05-09 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: fluentd
@@ -235,6 +236,7 @@ licenses:
235
236
  - Apache-2.0
236
237
  metadata:
237
238
  changelog_uri: https://github.com/uken/fluent-plugin-elasticsearch/blob/master/History.md
239
+ post_install_message:
238
240
  rdoc_options: []
239
241
  require_paths:
240
242
  - lib
@@ -249,7 +251,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
251
  - !ruby/object:Gem::Version
250
252
  version: '0'
251
253
  requirements: []
252
- rubygems_version: 3.6.7
254
+ rubygems_version: 3.4.6
255
+ signing_key:
253
256
  specification_version: 4
254
257
  summary: Elasticsearch output plugin for Fluent event collector
255
258
  test_files: