fluent-plugin-opensearch 1.0.5 → 1.0.8
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 +4 -4
- data/History.md +9 -0
- data/README.md +14 -1
- data/fluent-plugin-opensearch.gemspec +2 -1
- data/lib/fluent/plugin/out_opensearch.rb +20 -3
- data/test/plugin/test_out_opensearch.rb +9 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba58a770b6f7d4aa621091bee5315988649ef54d2bb4b4c23e980d9ee8598008
|
4
|
+
data.tar.gz: 5f6023c9456af019bf82141180a76b01bc322418456c191ceae72c7f794fe44f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98474ac3e7329082aace9f0d671c0ecf60844fa0bab91c431be8c0dc8ddd0bcfeca60ef0612d8c7e79459a4da528f266ecce0a42eea5029d28fce7483d6e87ec
|
7
|
+
data.tar.gz: 5879925be1f7b7079eb7f7c44d50145aab2f1b76afb6f99d3345252d25f96ce7b8fcf3bd1a215252d6e7a1ab76cc727a02bc6b2aaa854e9f98e969c485e7df61
|
data/History.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
### [Unreleased]
|
4
4
|
|
5
|
+
### 1.0.8
|
6
|
+
- Use faraday 1.x explicitly (#71)
|
7
|
+
|
8
|
+
### 1.0.7
|
9
|
+
- Expire AWS credentials with a certain interval (#52)
|
10
|
+
|
11
|
+
### 1.0.6
|
12
|
+
- out\_opensearch: Handle suppress\_type\_name operation correctly (#61)
|
13
|
+
|
5
14
|
### 1.0.5
|
6
15
|
- Use if clause to detect requirements for emitting error label events (#57)
|
7
16
|
- opensearch_data_stream: Align lowercases for data_stream and its template names (#50)
|
data/README.md
CHANGED
@@ -1432,7 +1432,7 @@ Specify AWS OpenSearch Service endpoint.
|
|
1432
1432
|
</endpoint>
|
1433
1433
|
```
|
1434
1434
|
|
1435
|
-
**NOTE:** This plugin will remove trailing slashes automatically. You don't need to pay
|
1435
|
+
**NOTE:** This plugin will remove trailing slashes automatically. You don't need to pay attention to the trailing slash characters.
|
1436
1436
|
|
1437
1437
|
#### access_key_id
|
1438
1438
|
|
@@ -1564,6 +1564,19 @@ In this case, the endpoint configuration looks like:
|
|
1564
1564
|
</endpoint>
|
1565
1565
|
```
|
1566
1566
|
|
1567
|
+
### Expiring AWS credentials
|
1568
|
+
|
1569
|
+
If you want to expire AWS credentials in certain interval, you should specify `refresh_credentials_interval` parameter under `endpoint` section:
|
1570
|
+
|
1571
|
+
```aconf
|
1572
|
+
<endpoint>
|
1573
|
+
url https://CLUSTER_ENDPOINT_URL
|
1574
|
+
region eu-west-1
|
1575
|
+
# ...
|
1576
|
+
refresh_credentials_interval 3h # default is 5h (five hours).
|
1577
|
+
</endpoint>
|
1578
|
+
```
|
1579
|
+
|
1567
1580
|
## Troubleshooting
|
1568
1581
|
|
1569
1582
|
See [Troubleshooting document](README.Troubleshooting.md)
|
@@ -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.0.
|
6
|
+
s.version = '1.0.8'
|
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}
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency 'excon', '>= 0'
|
27
27
|
s.add_runtime_dependency 'opensearch-ruby'
|
28
28
|
s.add_runtime_dependency "aws-sdk-core", "~> 3"
|
29
|
+
s.add_runtime_dependency "faraday", "~> 1.10"
|
29
30
|
s.add_runtime_dependency "faraday_middleware-aws-sigv4"
|
30
31
|
|
31
32
|
|
@@ -194,6 +194,7 @@ module Fluent::Plugin
|
|
194
194
|
config_param :assume_role_session_name, :string, :default => "fluentd"
|
195
195
|
config_param :assume_role_web_identity_token_file, :string, :default => nil
|
196
196
|
config_param :sts_credentials_region, :string, :default => nil
|
197
|
+
config_param :refresh_credentials_interval, :time, :default => "5h"
|
197
198
|
end
|
198
199
|
|
199
200
|
config_section :buffer do
|
@@ -336,6 +337,22 @@ module Fluent::Plugin
|
|
336
337
|
}
|
337
338
|
end
|
338
339
|
end
|
340
|
+
# If AWS credentials is set, consider to expire credentials information forcibly before expired.
|
341
|
+
@credential_mutex = Mutex.new
|
342
|
+
if @endpoint
|
343
|
+
@_aws_credentials = aws_credentials(@endpoint)
|
344
|
+
|
345
|
+
if @endpoint.refresh_credentials_interval
|
346
|
+
timer_execute(:out_opensearch_expire_credentials, @endpoint.refresh_credentials_interval) do
|
347
|
+
log.debug('Recreate the AWS credentials')
|
348
|
+
|
349
|
+
@credential_mutex.synchronize do
|
350
|
+
@_os = nil
|
351
|
+
@_aws_credentials = aws_credentials(@endpoint)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
339
356
|
|
340
357
|
@serializer_class = nil
|
341
358
|
begin
|
@@ -607,7 +624,7 @@ module Fluent::Plugin
|
|
607
624
|
:aws_sigv4,
|
608
625
|
service: 'es',
|
609
626
|
region: @endpoint.region,
|
610
|
-
credentials:
|
627
|
+
credentials: @_aws_credentials,
|
611
628
|
)
|
612
629
|
|
613
630
|
f.adapter @http_backend, @backend_options
|
@@ -989,7 +1006,7 @@ module Fluent::Plugin
|
|
989
1006
|
end
|
990
1007
|
end
|
991
1008
|
|
992
|
-
if @suppress_type_name
|
1009
|
+
if @suppress_type_name || @last_seen_major_version >= 2
|
993
1010
|
target_type = nil
|
994
1011
|
else
|
995
1012
|
# OpenSearch only supports "_doc".
|
@@ -998,7 +1015,7 @@ module Fluent::Plugin
|
|
998
1015
|
|
999
1016
|
meta.clear
|
1000
1017
|
meta["_index".freeze] = target_index
|
1001
|
-
meta["_type".freeze] = target_type
|
1018
|
+
meta["_type".freeze] = target_type unless target_type.nil?
|
1002
1019
|
meta["_alias".freeze] = target_index_alias
|
1003
1020
|
|
1004
1021
|
if @pipeline
|
@@ -2320,8 +2320,9 @@ class OpenSearchOutputTest < Test::Unit::TestCase
|
|
2320
2320
|
end
|
2321
2321
|
|
2322
2322
|
data(
|
2323
|
-
"OpenSearch default"=> {"os_version" => 1, "_type" => "_doc", "suppress_type" => false},
|
2324
|
-
"Suppressed type"
|
2323
|
+
"OpenSearch default" => {"os_version" => 1, "_type" => "_doc", "suppress_type" => false},
|
2324
|
+
"Suppressed type" => {"os_version" => 1, "_type" => nil, "suppress_type" => true},
|
2325
|
+
"OpenSearch 2" => {"os_version" => 2, "_type" => nil, "suppress_type" => true},
|
2325
2326
|
)
|
2326
2327
|
def test_writes_to_speficied_type(data)
|
2327
2328
|
driver('', data["os_version"]).configure("suppress_type_name #{data['suppress_type']}")
|
@@ -2330,7 +2331,12 @@ class OpenSearchOutputTest < Test::Unit::TestCase
|
|
2330
2331
|
driver.run(default_tag: 'test') do
|
2331
2332
|
driver.feed(sample_record)
|
2332
2333
|
end
|
2333
|
-
|
2334
|
+
if data["suppress_type"] || data["os_version"] >= 2
|
2335
|
+
assert_false(index_cmds.first['index'].has_key?("_type"))
|
2336
|
+
else
|
2337
|
+
assert_true(index_cmds.first['index'].has_key?("_type"))
|
2338
|
+
assert_equal(data['_type'], index_cmds.first['index']['_type'])
|
2339
|
+
end
|
2334
2340
|
end
|
2335
2341
|
|
2336
2342
|
def test_writes_to_speficied_host
|
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.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.10'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.10'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: faraday_middleware-aws-sigv4
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|