fluent-plugin-opensearch 1.0.10 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linux.yml +1 -1
- data/.github/workflows/macos.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/History.md +8 -0
- data/README.md +2 -0
- data/fluent-plugin-opensearch.gemspec +5 -4
- data/lib/fluent/plugin/in_opensearch.rb +1 -0
- data/lib/fluent/plugin/out_opensearch.rb +23 -5
- data/test/plugin/test_out_opensearch.rb +3 -0
- metadata +34 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c4ad0e88f3c4bb0497f3af7d1fa669bc0a9e0820fd7ccbe32713fa86f9fdc69
|
4
|
+
data.tar.gz: 56626ed3aadd52c4b560fb6eb8d9a0c0070ac68178ce789a63db19c404ab39e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 620d0a42bb7b4db1bdd32bf863697644a5afc499a4d9b071a99192cfb8c621dd863e8f35f30ae6eab6ab90e982ed5a68a2dbab83de6f7b526e44ebe419fd6c5b
|
7
|
+
data.tar.gz: ca2cdd6fa2a704423e7cee2c065e72075b6e0d564414d5dcc1feb08608aa303fa93b9bf57afde32ed8a6e90c707bbe2c89bcdfcf8af84aabec904d1d52222dfd
|
data/.github/workflows/linux.yml
CHANGED
data/.github/workflows/macos.yml
CHANGED
data/History.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
### [Unreleased]
|
4
4
|
|
5
|
+
### 1.1.1
|
6
|
+
- Pass a value of refresh\_credentials\_interval as duration\_seconds (#78)
|
7
|
+
|
8
|
+
### 1.1.0
|
9
|
+
- Unpin `faraday` from v1, upgrade to v2.
|
10
|
+
Note that if you can't migrate other plugins from `faraday` v1 yet, need to keep
|
11
|
+
fluent-plugin-opensearch v1.0.10.
|
12
|
+
|
5
13
|
### 1.0.10
|
6
14
|
- Replace File.exists? with File.exist? to work with Ruby 3.2 (#93)
|
7
15
|
- Add a constraint for dependent gem to stay on Faraday v1 (#90)
|
data/README.md
CHANGED
@@ -111,6 +111,8 @@ Send your logs to OpenSearch (and search them with OpenSearch Dashboards maybe?)
|
|
111
111
|
|:----------------------------:|:-----------:|:------:|
|
112
112
|
| >= 1.0.0 | >= v1.x | >= 2.4 |
|
113
113
|
|
114
|
+
NOTE: Since fluent-plugin-opensearch 1.1.0, it requires faraday 2.0 or later.
|
115
|
+
|
114
116
|
NOTE: This documentation is for fluent-plugin-opensearch 1.x or later.
|
115
117
|
|
116
118
|
## Installation
|
@@ -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.
|
6
|
+
s.version = '1.1.1'
|
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}
|
@@ -23,11 +23,12 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.required_ruby_version = Gem::Requirement.new(">= 2.3".freeze)
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'fluentd', '>= 0.14.22'
|
26
|
-
s.add_runtime_dependency 'excon', '>= 0'
|
27
26
|
s.add_runtime_dependency 'opensearch-ruby'
|
28
27
|
s.add_runtime_dependency "aws-sdk-core", "~> 3"
|
29
|
-
s.add_runtime_dependency
|
30
|
-
s.add_runtime_dependency
|
28
|
+
s.add_runtime_dependency 'excon', '>= 0'
|
29
|
+
s.add_runtime_dependency 'faraday', '>= 2.0.0'
|
30
|
+
s.add_runtime_dependency 'faraday-excon', '>= 2.0.0'
|
31
|
+
s.add_runtime_dependency "faraday_middleware-aws-sigv4", "~> 1.0.1"
|
31
32
|
|
32
33
|
s.add_development_dependency 'rake', '>= 0'
|
33
34
|
s.add_development_dependency 'webrick', '~> 1.7.0'
|
@@ -56,6 +56,7 @@ rescue LoadError
|
|
56
56
|
end
|
57
57
|
require 'aws-sdk-core'
|
58
58
|
require 'faraday_middleware/aws_sigv4'
|
59
|
+
require 'faraday/excon'
|
59
60
|
|
60
61
|
module Fluent::Plugin
|
61
62
|
class OpenSearchOutput < Output
|
@@ -82,6 +83,7 @@ module Fluent::Plugin
|
|
82
83
|
attr_reader :template_names
|
83
84
|
attr_reader :ssl_version_options
|
84
85
|
attr_reader :compressable_connection
|
86
|
+
attr_reader :duration_seconds
|
85
87
|
|
86
88
|
helpers :event_emitter, :compat_parameters, :record_accessor, :timer
|
87
89
|
|
@@ -93,6 +95,7 @@ module Fluent::Plugin
|
|
93
95
|
DEFAULT_RELOAD_AFTER = -1
|
94
96
|
DEFAULT_TARGET_BULK_BYTES = -1
|
95
97
|
DEFAULT_POLICY_ID = "logstash-policy"
|
98
|
+
DEFAULT_DURATION = "5h"
|
96
99
|
|
97
100
|
config_param :host, :string, :default => 'localhost'
|
98
101
|
config_param :port, :integer, :default => 9200
|
@@ -194,7 +197,7 @@ module Fluent::Plugin
|
|
194
197
|
config_param :assume_role_session_name, :string, :default => "fluentd"
|
195
198
|
config_param :assume_role_web_identity_token_file, :string, :default => nil
|
196
199
|
config_param :sts_credentials_region, :string, :default => nil
|
197
|
-
config_param :refresh_credentials_interval, :time, :default =>
|
200
|
+
config_param :refresh_credentials_interval, :time, :default => DEFAULT_DURATION
|
198
201
|
config_param :aws_service_name, :enum, list: [:es, :aoss], :default => :es
|
199
202
|
end
|
200
203
|
|
@@ -210,6 +213,8 @@ module Fluent::Plugin
|
|
210
213
|
|
211
214
|
def initialize
|
212
215
|
super
|
216
|
+
|
217
|
+
@duration_seconds = Fluent::Config.time_value(DEFAULT_DURATION)
|
213
218
|
end
|
214
219
|
|
215
220
|
######################################################################################################
|
@@ -237,13 +242,15 @@ module Fluent::Plugin
|
|
237
242
|
credentials = Aws::AssumeRoleCredentials.new({
|
238
243
|
role_arn: conf[:assume_role_arn],
|
239
244
|
role_session_name: conf[:assume_role_session_name],
|
240
|
-
region: sts_creds_region(conf)
|
245
|
+
region: sts_creds_region(conf),
|
246
|
+
duration_seconds: @duration_seconds
|
241
247
|
}).credentials
|
242
248
|
else
|
243
249
|
credentials = Aws::AssumeRoleWebIdentityCredentials.new({
|
244
250
|
role_arn: conf[:assume_role_arn],
|
245
251
|
web_identity_token_file: conf[:assume_role_web_identity_token_file],
|
246
|
-
region: sts_creds_region(conf)
|
252
|
+
region: sts_creds_region(conf),
|
253
|
+
duration_seconds: @duration_seconds
|
247
254
|
}).credentials
|
248
255
|
end
|
249
256
|
end
|
@@ -344,7 +351,18 @@ module Fluent::Plugin
|
|
344
351
|
@_aws_credentials = aws_credentials(@endpoint)
|
345
352
|
|
346
353
|
if @endpoint.refresh_credentials_interval
|
347
|
-
|
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
366
|
log.debug('Recreate the AWS credentials')
|
349
367
|
|
350
368
|
@credential_mutex.synchronize do
|
@@ -509,7 +527,7 @@ module Fluent::Plugin
|
|
509
527
|
when :excon
|
510
528
|
{ client_key: @client_key, client_cert: @client_cert, client_key_pass: @client_key_pass, nonblock: @http_backend_excon_nonblock }
|
511
529
|
when :typhoeus
|
512
|
-
require 'typhoeus'
|
530
|
+
require 'faraday/typhoeus'
|
513
531
|
{ sslkey: @client_key, sslcert: @client_cert, keypasswd: @client_key_pass }
|
514
532
|
end
|
515
533
|
rescue LoadError => ex
|
@@ -300,6 +300,7 @@ 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'
|
303
304
|
}, []),
|
304
305
|
Fluent::Config::Element.new('buffer', 'tag', {}, [])
|
305
306
|
|
@@ -316,6 +317,8 @@ class OpenSearchOutputTest < Test::Unit::TestCase
|
|
316
317
|
assert_nil instance.endpoint.assume_role_web_identity_token_file
|
317
318
|
assert_nil instance.endpoint.sts_credentials_region
|
318
319
|
assert_equal :es, instance.endpoint.aws_service_name
|
320
|
+
assert_equal 36000, instance.endpoint.refresh_credentials_interval
|
321
|
+
assert_equal 36000, instance.duration_seconds
|
319
322
|
end
|
320
323
|
|
321
324
|
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.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.14.22
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: opensearch-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,21 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: aws-sdk-core
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: excon
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -53,47 +67,47 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: faraday
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 2.0.0
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.0.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: faraday
|
84
|
+
name: faraday-excon
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 2.0.0
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 2.0.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: faraday_middleware-aws-sigv4
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
103
|
+
version: 1.0.1
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
110
|
+
version: 1.0.1
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,7 +255,7 @@ licenses:
|
|
241
255
|
- Apache-2.0
|
242
256
|
metadata:
|
243
257
|
changelog_uri: https://github.com/fluent/fluent-plugin-opensearch/blob/master/History.md
|
244
|
-
post_install_message:
|
258
|
+
post_install_message:
|
245
259
|
rdoc_options: []
|
246
260
|
require_paths:
|
247
261
|
- lib
|
@@ -256,8 +270,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
270
|
- !ruby/object:Gem::Version
|
257
271
|
version: '0'
|
258
272
|
requirements: []
|
259
|
-
rubygems_version: 3.
|
260
|
-
signing_key:
|
273
|
+
rubygems_version: 3.2.32
|
274
|
+
signing_key:
|
261
275
|
specification_version: 4
|
262
276
|
summary: Opensearch output plugin for Fluent event collector
|
263
277
|
test_files:
|