fluent-plugin-input-opensearch 1.2.3 → 1.2.5
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/README.md +2 -2
- data/lib/fluent/plugin/in_opensearch.rb +8 -6
- data/lib/fluent/plugin/out_opensearch.rb +5 -1
- metadata +5 -55
- data/.coveralls.yml +0 -1
- data/.editorconfig +0 -9
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -24
- data/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -9
- data/.github/workflows/coverage.yaml +0 -22
- data/.github/workflows/issue-auto-closer.yml +0 -12
- data/.github/workflows/linux.yml +0 -26
- data/.github/workflows/macos.yml +0 -26
- data/.github/workflows/windows.yml +0 -26
- data/.gitignore +0 -18
- data/CONTRIBUTING.md +0 -24
- data/Gemfile +0 -10
- data/History.md +0 -67
- data/README.OpenSearchGenID.md +0 -116
- data/README.OpenSearchInput.md +0 -396
- data/README.Troubleshooting.md +0 -482
- data/Rakefile +0 -37
- data/fluent-plugin-opensearch.gemspec +0 -39
- data/gemfiles/Gemfile.elasticsearch.v6 +0 -12
- data/test/helper.rb +0 -60
- data/test/plugin/datastream_template.json +0 -4
- data/test/plugin/test_alias_template.json +0 -9
- data/test/plugin/test_filter_opensearch_genid.rb +0 -241
- data/test/plugin/test_in_opensearch.rb +0 -500
- data/test/plugin/test_index_alias_template.json +0 -11
- data/test/plugin/test_index_template.json +0 -25
- data/test/plugin/test_oj_serializer.rb +0 -45
- data/test/plugin/test_opensearch_error_handler.rb +0 -770
- data/test/plugin/test_opensearch_fallback_selector.rb +0 -100
- data/test/plugin/test_opensearch_tls.rb +0 -171
- data/test/plugin/test_out_opensearch.rb +0 -3980
- data/test/plugin/test_out_opensearch_data_stream.rb +0 -746
- data/test/plugin/test_template.json +0 -23
- data/test/test_log-ext.rb +0 -61
@@ -1,241 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
#
|
3
|
-
# The fluent-plugin-opensearch Contributors require contributions made to
|
4
|
-
# this file be licensed under the Apache-2.0 license or a
|
5
|
-
# compatible open source license.
|
6
|
-
#
|
7
|
-
# Modifications Copyright fluent-plugin-opensearch Contributors. See
|
8
|
-
# GitHub history for details.
|
9
|
-
#
|
10
|
-
# Licensed to Uken Inc. under one or more contributor
|
11
|
-
# license agreements. See the NOTICE file distributed with
|
12
|
-
# this work for additional information regarding copyright
|
13
|
-
# ownership. Uken Inc. licenses this file to you under
|
14
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
15
|
-
# not use this file except in compliance with the License.
|
16
|
-
# You may obtain a copy of the License at
|
17
|
-
#
|
18
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
19
|
-
#
|
20
|
-
# Unless required by applicable law or agreed to in writing,
|
21
|
-
# software distributed under the License is distributed on an
|
22
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
23
|
-
# KIND, either express or implied. See the License for the
|
24
|
-
# specific language governing permissions and limitations
|
25
|
-
# under the License.
|
26
|
-
|
27
|
-
require_relative '../helper'
|
28
|
-
require 'date'
|
29
|
-
require 'fluent/test/helpers'
|
30
|
-
require 'json'
|
31
|
-
require 'fluent/test/driver/filter'
|
32
|
-
require 'flexmock/test_unit'
|
33
|
-
require 'fluent/plugin/filter_opensearch_genid'
|
34
|
-
|
35
|
-
class OpenSearchGenidFilterTest < Test::Unit::TestCase
|
36
|
-
include FlexMock::TestCase
|
37
|
-
include Fluent::Test::Helpers
|
38
|
-
|
39
|
-
def setup
|
40
|
-
Fluent::Test.setup
|
41
|
-
end
|
42
|
-
|
43
|
-
def create_driver(conf='')
|
44
|
-
Fluent::Test::Driver::Filter.new(Fluent::Plugin::OpenSearchGenidFilter).configure(conf)
|
45
|
-
end
|
46
|
-
|
47
|
-
test "invalid configuration" do
|
48
|
-
assert_raise(Fluent::ConfigError) do
|
49
|
-
create_driver("use_record_as_seed true")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def sample_record
|
54
|
-
{'age' => 26, 'request_id' => '42', 'parent_id' => 'parent', 'routing_id' => 'routing'}
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_configure
|
58
|
-
d = create_driver
|
59
|
-
assert_equal '_hash', d.instance.hash_id_key
|
60
|
-
end
|
61
|
-
|
62
|
-
data("default" => {"hash_id_key" => "_hash"},
|
63
|
-
"custom_key" => {"hash_id_key" => "_edited"},
|
64
|
-
)
|
65
|
-
def test_filter(data)
|
66
|
-
d = create_driver("hash_id_key #{data["hash_id_key"]}")
|
67
|
-
flexmock(SecureRandom).should_receive(:uuid)
|
68
|
-
.and_return("13a0c028-bf7c-4ae2-ad03-ec09a40006df")
|
69
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
70
|
-
d.run(default_tag: 'test') do
|
71
|
-
d.feed(time, sample_record)
|
72
|
-
end
|
73
|
-
assert_equal(Base64.strict_encode64(SecureRandom.uuid),
|
74
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
75
|
-
end
|
76
|
-
|
77
|
-
class UseRecordAsSeedTest < self
|
78
|
-
data("md5" => ["md5", "PPg+zmH1ASUCpNzMUcTzqw=="],
|
79
|
-
"sha1" => ["sha1", "JKfCrEAxeAyRSdcKqkw4unC9xZ8="],
|
80
|
-
"sha256" => ["sha256", "9Z9i+897bGivSItD/6i0vye9uRwq/sLwWkxOwydtTJY="],
|
81
|
-
"sha512" => ["sha512", "KWI5OdZPaCFW9/CEY3NoGrvueMtjZJdmGdqIVGJP8vgI4uW+0gHExZVaHerw+RhbtIdLCtVZ43xBgMKH+KliQg=="],
|
82
|
-
)
|
83
|
-
def test_simple(data)
|
84
|
-
hash_type, expected = data
|
85
|
-
d = create_driver(%[
|
86
|
-
use_record_as_seed true
|
87
|
-
record_keys age,parent_id,routing_id,custom_key
|
88
|
-
hash_type #{hash_type}
|
89
|
-
])
|
90
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
91
|
-
d.run(default_tag: 'test') do
|
92
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
93
|
-
end
|
94
|
-
assert_equal(expected,
|
95
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
96
|
-
end
|
97
|
-
|
98
|
-
data("md5" => ["md5", "qUO/xqWiOJq4D0ApdoHVEQ=="],
|
99
|
-
"sha1" => ["sha1", "v3UWYr90zIH2veGQBVwUH586TuI="],
|
100
|
-
"sha256" => ["sha256", "4hwh10qfw9B24NtNFoEFF8wCiImvgIy1Vk4gzcKt5Pw="],
|
101
|
-
"sha512" => ["sha512", "TY3arcmC8mhYClDIjQxH8ePRLnHK01Cj5QQL8FxbwNtPQBY3IZ4qJY9CpOusmdWBYwm1golRVQCmURiAhlnWIQ=="],)
|
102
|
-
def test_record_with_tag(data)
|
103
|
-
hash_type, expected = data
|
104
|
-
d = create_driver(%[
|
105
|
-
use_record_as_seed true
|
106
|
-
record_keys age,parent_id,routing_id,custom_key
|
107
|
-
hash_type #{hash_type}
|
108
|
-
include_tag_in_seed true
|
109
|
-
])
|
110
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
111
|
-
d.run(default_tag: 'test.fluentd') do
|
112
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
113
|
-
end
|
114
|
-
assert_equal(expected,
|
115
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
116
|
-
end
|
117
|
-
|
118
|
-
data("md5" => ["md5", "oHo+PoC5I4KC+XCfXvyf9w=="],
|
119
|
-
"sha1" => ["sha1", "50Nwarm2225gLy1ka8d9i+W6cKA="],
|
120
|
-
"sha256" => ["sha256", "ReX1XgizcrHjBc0sQwx9Sjuf2QBFll2njYf4ee+XSIc="],
|
121
|
-
"sha512" => ["sha512", "8bcpZrqNUQIz6opdoVZz0MwxP8r9SCqOEPkWF6xGLlFwPCJVqk2SQp99m8rPufr0xPIgvZyOMejA5slBV9xrdg=="],)
|
122
|
-
def test_record_with_time(data)
|
123
|
-
hash_type, expected = data
|
124
|
-
d = create_driver(%[
|
125
|
-
use_record_as_seed true
|
126
|
-
record_keys age,parent_id,routing_id,custom_key
|
127
|
-
hash_type #{hash_type}
|
128
|
-
include_time_in_seed true
|
129
|
-
])
|
130
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
131
|
-
d.run(default_tag: 'test.fluentd') do
|
132
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
133
|
-
end
|
134
|
-
assert_equal(expected,
|
135
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
136
|
-
end
|
137
|
-
|
138
|
-
data("md5" => ["md5", "u7/hr09gDC9CM5DI7tLc2Q=="],
|
139
|
-
"sha1" => ["sha1", "1WgptcTnVSHtTAlNUwNcoiaY3oM="],
|
140
|
-
"sha256" => ["sha256", "1iWZHI19m/A1VH8iFK7H2KFoyLdszpJRiVeKBv1Ndis="],
|
141
|
-
"sha512" => ["sha512", "NM+ui0lUmeDaEJsT7c9EyTc+lQBbRf1x6MQXXYdxp21CX3jZvHy3IT8Xp9ZdIKevZwhoo3Suo/tIBlfyLFXJXw=="],)
|
142
|
-
def test_record_with_tag_and_time
|
143
|
-
hash_type, expected = data
|
144
|
-
d = create_driver(%[
|
145
|
-
use_record_as_seed true
|
146
|
-
record_keys age,parent_id,routing_id,custom_key
|
147
|
-
hash_type #{hash_type}
|
148
|
-
include_tag_in_seed true
|
149
|
-
include_time_in_seed true
|
150
|
-
])
|
151
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
152
|
-
d.run(default_tag: 'test.fluentd') do
|
153
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
154
|
-
end
|
155
|
-
assert_equal(expected,
|
156
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
class UseEntireRecordAsSeedTest < self
|
161
|
-
data("md5" => ["md5", "MuMU0gHOP1cWvvg/J4aEFg=="],
|
162
|
-
"sha1" => ["sha1", "GZ6Iup9Ywyk5spCWtPQbtZnfK0U="],
|
163
|
-
"sha256" => ["sha256", "O4YN0RiXCUAYeaR97UUULRLxgra/R2dvTV47viir5l4="],
|
164
|
-
"sha512" => ["sha512", "FtbwO1xsLUq0KcO0mj0l80rbwFH5rGE3vL+Vgh90+4R/9j+/Ni/ipwhiOoUcetDxj1r5Vf/92B54La+QTu3eMA=="],)
|
165
|
-
def test_record
|
166
|
-
hash_type, expected = data
|
167
|
-
d = create_driver(%[
|
168
|
-
use_record_as_seed true
|
169
|
-
use_entire_record true
|
170
|
-
hash_type #{hash_type}
|
171
|
-
])
|
172
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
173
|
-
d.run(default_tag: 'test.fluentd') do
|
174
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
175
|
-
end
|
176
|
-
assert_equal(expected,
|
177
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
178
|
-
end
|
179
|
-
|
180
|
-
data("md5" => ["md5", "GJfpWe8ofiGzn97bc9Gh0Q=="],
|
181
|
-
"sha1" => ["sha1", "AVaK67Tz0bEJ8xNEzjOQ6r9fAu4="],
|
182
|
-
"sha256" => ["sha256", "WIXWAuf/Z94Uw95mudloo2bgjhSsSduQIwkKTQsNFgU="],
|
183
|
-
"sha512" => ["sha512", "yjMGGxy8uc7gCrPgm8W6MzJGLFk0GtUwJ6w/91laf6WNywuvG/7T6kNHLagAV8rSW8xzxmtEfyValBO5scuoKw=="],)
|
184
|
-
def test_record_with_tag
|
185
|
-
hash_type, expected = data
|
186
|
-
d = create_driver(%[
|
187
|
-
use_record_as_seed true
|
188
|
-
use_entire_record true
|
189
|
-
hash_type #{hash_type}
|
190
|
-
include_tag_in_seed true
|
191
|
-
])
|
192
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
193
|
-
d.run(default_tag: 'test.fluentd') do
|
194
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
195
|
-
end
|
196
|
-
assert_equal(expected,
|
197
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
198
|
-
end
|
199
|
-
|
200
|
-
data("md5" => ["md5", "5nQSaJ4F1p9rDFign13Lfg=="],
|
201
|
-
"sha1" => ["sha1", "hyo9+0ZFBpizKl2NShs3C8yQcGw="],
|
202
|
-
"sha256" => ["sha256", "romVsZSIksbqYsOSnUzolZQw76ankcy0DgvDZ3CayTo="],
|
203
|
-
"sha512" => ["sha512", "RPU7K2Pt0iVyvV7p5usqcUIIOmfTajD1aa7pkR9qZ89UARH/lpm6ESY9iwuYJj92lxOUuF5OxlEwvV7uXJ07iA=="],)
|
204
|
-
def test_record_with_time
|
205
|
-
hash_type, expected = data
|
206
|
-
d = create_driver(%[
|
207
|
-
use_record_as_seed true
|
208
|
-
use_entire_record true
|
209
|
-
hash_type #{hash_type}
|
210
|
-
include_time_in_seed true
|
211
|
-
])
|
212
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
213
|
-
d.run(default_tag: 'test.fluentd') do
|
214
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
215
|
-
end
|
216
|
-
assert_equal(expected,
|
217
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
218
|
-
end
|
219
|
-
|
220
|
-
data("md5" => ["md5", "zGQF35KlMUibJAcgkgQDtw=="],
|
221
|
-
"sha1" => ["sha1", "1x9RZO1xEuWps090qq4DUIsU9x8="],
|
222
|
-
"sha256" => ["sha256", "eulMz0eF56lBEf31aIs0OG2TGCH/aoPfZbRqfEOkAwk="],
|
223
|
-
"sha512" => ["sha512", "mIiYATtpdUFEFCIZg1FdKssIs7oWY0gJjhSSbet0ddUmqB+CiQAcAMTmrXO6AVSH0vsMvao/8vtC8AsIPfF1fA=="],)
|
224
|
-
def test_record_with_tag_and_time
|
225
|
-
hash_type, expected = data
|
226
|
-
d = create_driver(%[
|
227
|
-
use_record_as_seed true
|
228
|
-
use_entire_record true
|
229
|
-
hash_type #{hash_type}
|
230
|
-
include_tag_in_seed true
|
231
|
-
include_time_in_seed true
|
232
|
-
])
|
233
|
-
time = event_time("2017-10-15 15:00:23.34567890 UTC")
|
234
|
-
d.run(default_tag: 'test.fluentd') do
|
235
|
-
d.feed(time, sample_record.merge("custom_key" => "This is also encoded value."))
|
236
|
-
end
|
237
|
-
assert_equal(expected,
|
238
|
-
d.filtered.map {|e| e.last}.first[d.instance.hash_id_key])
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|