fluent-plugin-opensearch 1.1.1 → 1.1.3

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: 4c4ad0e88f3c4bb0497f3af7d1fa669bc0a9e0820fd7ccbe32713fa86f9fdc69
4
- data.tar.gz: 56626ed3aadd52c4b560fb6eb8d9a0c0070ac68178ce789a63db19c404ab39e7
3
+ metadata.gz: 8b8b954980a5eb5fd96702cac11352951aea3f3ed18485e151b4642f415ab026
4
+ data.tar.gz: aeb250f72fa691f558471d88dfde6081c24115049ec995acbc7c58a2799cbecd
5
5
  SHA512:
6
- metadata.gz: 620d0a42bb7b4db1bdd32bf863697644a5afc499a4d9b071a99192cfb8c621dd863e8f35f30ae6eab6ab90e982ed5a68a2dbab83de6f7b526e44ebe419fd6c5b
7
- data.tar.gz: ca2cdd6fa2a704423e7cee2c065e72075b6e0d564414d5dcc1feb08608aa303fa93b9bf57afde32ed8a6e90c707bbe2c89bcdfcf8af84aabec904d1d52222dfd
6
+ metadata.gz: 51a4428c631b285a8769e82cecc8d9c67e4f3f89cabb8b36520170a594e41ddda56729a6b9aaf6a43808063f6904624997a88fd522a7756dfc2cdea1e20a2b3f
7
+ data.tar.gz: e301856f437a3dce63d7cf3012156f5ae80234a3faa572b00c3aee2a505e50087e8dfc8f763db1f72733457225c290e102887efe46bb3ae21c0a3e849e326900
data/History.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 1.1.3
6
+ - Revert the behavior of passing duration second (#108)
7
+
8
+ ### 1.1.2
9
+ - Check OS cluster for data streams and templates for index template creation (#106)
10
+ - out\_opensearch\_data\_stream: Don't connect to opensearch on dry-run (#105)
11
+
5
12
  ### 1.1.1
6
13
  - Pass a value of refresh\_credentials\_interval as duration\_seconds (#78)
7
14
 
@@ -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-opensearch'
6
- s.version = '1.1.1'
6
+ s.version = '1.1.3'
7
7
  s.authors = ['Hiroshi Hatake']
8
8
  s.email = ['cosmo0920.wp@gmail.com']
9
9
  s.description = %q{Opensearch output plugin for Fluent event collector}
@@ -83,7 +83,6 @@ module Fluent::Plugin
83
83
  attr_reader :template_names
84
84
  attr_reader :ssl_version_options
85
85
  attr_reader :compressable_connection
86
- attr_reader :duration_seconds
87
86
 
88
87
  helpers :event_emitter, :compat_parameters, :record_accessor, :timer
89
88
 
@@ -95,7 +94,6 @@ module Fluent::Plugin
95
94
  DEFAULT_RELOAD_AFTER = -1
96
95
  DEFAULT_TARGET_BULK_BYTES = -1
97
96
  DEFAULT_POLICY_ID = "logstash-policy"
98
- DEFAULT_DURATION = "5h"
99
97
 
100
98
  config_param :host, :string, :default => 'localhost'
101
99
  config_param :port, :integer, :default => 9200
@@ -197,7 +195,7 @@ module Fluent::Plugin
197
195
  config_param :assume_role_session_name, :string, :default => "fluentd"
198
196
  config_param :assume_role_web_identity_token_file, :string, :default => nil
199
197
  config_param :sts_credentials_region, :string, :default => nil
200
- config_param :refresh_credentials_interval, :time, :default => DEFAULT_DURATION
198
+ config_param :refresh_credentials_interval, :time, :default => "5h"
201
199
  config_param :aws_service_name, :enum, list: [:es, :aoss], :default => :es
202
200
  end
203
201
 
@@ -213,8 +211,6 @@ module Fluent::Plugin
213
211
 
214
212
  def initialize
215
213
  super
216
-
217
- @duration_seconds = Fluent::Config.time_value(DEFAULT_DURATION)
218
214
  end
219
215
 
220
216
  ######################################################################################################
@@ -242,15 +238,13 @@ module Fluent::Plugin
242
238
  credentials = Aws::AssumeRoleCredentials.new({
243
239
  role_arn: conf[:assume_role_arn],
244
240
  role_session_name: conf[:assume_role_session_name],
245
- region: sts_creds_region(conf),
246
- duration_seconds: @duration_seconds
241
+ region: sts_creds_region(conf)
247
242
  }).credentials
248
243
  else
249
244
  credentials = Aws::AssumeRoleWebIdentityCredentials.new({
250
245
  role_arn: conf[:assume_role_arn],
251
246
  web_identity_token_file: conf[:assume_role_web_identity_token_file],
252
- region: sts_creds_region(conf),
253
- duration_seconds: @duration_seconds
247
+ region: sts_creds_region(conf)
254
248
  }).credentials
255
249
  end
256
250
  end
@@ -351,18 +345,7 @@ module Fluent::Plugin
351
345
  @_aws_credentials = aws_credentials(@endpoint)
352
346
 
353
347
  if @endpoint.refresh_credentials_interval
354
- @duration_seconds = Fluent::Config.time_value(@endpoint.refresh_credentials_interval)
355
- # 60 * 60 * 12 = 12 hours
356
- if @duration_seconds > 43200
357
- raise Fluent::ConfigError, "Maximum duration is 12 hours."
358
- end
359
-
360
- # 60 * 15 = 15 minutes
361
- if @duration_seconds < 900
362
- raise Fluent::ConfigError, "Minimum duration is 15 minutes."
363
- end
364
-
365
- timer_execute(:out_opensearch_expire_credentials, @duration_seconds) do
348
+ timer_execute(:out_opensearch_expire_credentials, @endpoint.refresh_credentials_interval) do
366
349
  log.debug('Recreate the AWS credentials')
367
350
 
368
351
  @credential_mutex.synchronize do
@@ -69,23 +69,26 @@ module Fluent::Plugin
69
69
 
70
70
  def create_index_template(datastream_name, template_name, host = nil)
71
71
  # Create index template from file
72
- if @template_file
73
- template_installation_actual(template_name, @customize_template, @application_name, datastream_name, host)
74
- else # Create default index template
75
- return if data_stream_exist?(datastream_name, host) or template_exists?(template_name, host)
76
- body = {
77
- "index_patterns" => ["#{datastream_name}*"],
78
- "data_stream" => {},
79
- }
80
-
81
- params = {
82
- name: template_name,
83
- body: body
84
- }
85
- retry_operate(@max_retry_putting_template,
86
- @fail_on_putting_template_retry_exceed,
87
- @catch_transport_exception_on_retry) do
88
- client(host).indices.put_index_template(params)
72
+ if !dry_run?
73
+ if @template_file
74
+ return if data_stream_exist?(datastream_name, host) or template_exists?(template_name, host)
75
+ template_installation_actual(template_name, @customize_template, @application_name, datastream_name, host)
76
+ else # Create default index template
77
+ return if data_stream_exist?(datastream_name, host) or template_exists?(template_name, host)
78
+ body = {
79
+ "index_patterns" => ["#{datastream_name}*"],
80
+ "data_stream" => {},
81
+ }
82
+
83
+ params = {
84
+ name: template_name,
85
+ body: body
86
+ }
87
+ retry_operate(@max_retry_putting_template,
88
+ @fail_on_putting_template_retry_exceed,
89
+ @catch_transport_exception_on_retry) do
90
+ client(host).indices.put_index_template(params)
91
+ end
89
92
  end
90
93
  end
91
94
  end
@@ -159,13 +162,10 @@ module Fluent::Plugin
159
162
  end
160
163
  data_stream_name = extract_placeholders(@data_stream_name, chunk).downcase
161
164
  data_stream_template_name = extract_placeholders(@data_stream_template_name, chunk).downcase
162
- unless @data_stream_names.include?(data_stream_name)
163
- begin
164
- create_index_template(data_stream_name, data_stream_template_name, host)
165
- @data_stream_names << data_stream_name
166
- rescue => e
167
- raise Fluent::ConfigError, "Failed to create data stream: <#{data_stream_name}> #{e.message}"
168
- end
165
+ begin
166
+ create_index_template(data_stream_name, data_stream_template_name, host)
167
+ rescue => e
168
+ raise Fluent::ConfigError, "Failed to create data stream: <#{data_stream_name}> #{e.message}"
169
169
  end
170
170
  end
171
171
 
@@ -300,7 +300,6 @@ class OpenSearchOutputTest < Test::Unit::TestCase
300
300
  'region' => "local",
301
301
  'access_key_id' => 'YOUR_AWESOME_KEY',
302
302
  'secret_access_key' => 'YOUR_AWESOME_SECRET',
303
- 'refresh_credentials_interval' => '10h'
304
303
  }, []),
305
304
  Fluent::Config::Element.new('buffer', 'tag', {}, [])
306
305
 
@@ -317,8 +316,6 @@ class OpenSearchOutputTest < Test::Unit::TestCase
317
316
  assert_nil instance.endpoint.assume_role_web_identity_token_file
318
317
  assert_nil instance.endpoint.sts_credentials_region
319
318
  assert_equal :es, instance.endpoint.aws_service_name
320
- assert_equal 36000, instance.endpoint.refresh_credentials_interval
321
- assert_equal 36000, instance.duration_seconds
322
319
  end
323
320
 
324
321
  data("OpenSearch Service" => [:es, 'es'],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-opensearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Hatake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd