logstash-output-opensearch 2.0.1-java → 2.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/MAINTAINERS.md +11 -1
- data/lib/logstash/outputs/opensearch/http_client/manticore_adapter.rb +17 -1
- data/logstash-output-opensearch.gemspec +1 -1
- data/spec/unit/outputs/opensearch/http_client/manticore_adapter_spec.rb +65 -20
- data.tar.gz.sig +0 -0
- metadata +11 -11
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9700db92f60b264d7edf26bb34281f9fac13c27d93564d80ce007e5e7b73928
|
4
|
+
data.tar.gz: a4feb8d63b747cd2db45ec1b47df5e30a6aea6dbee3a30dde51c94773b192ec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ad196b7d23790cf9bed976a3c51b0a2ebbd2d1bb9fa92617a9994620d0be287c142c5ce944cb941626f598491d38b112d68797f7953e63180204522a639af3
|
7
|
+
data.tar.gz: cdd308cd216f67382e466e98546f04e6ac1a011e6d4f64e4b27e23d44809ae6a069c3849e62986a0f79ccb26d40eaa12fb998271072efaf87be1a5ca765da48a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/MAINTAINERS.md
CHANGED
@@ -4,11 +4,21 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
|
|
4
4
|
|
5
5
|
## Current Maintainers
|
6
6
|
|
7
|
+
|
8
|
+
| Maintainer | GitHub ID | Affiliation |
|
9
|
+
| ----------------------- | ------------------------------------------- | ----------- |
|
10
|
+
| Asif Sohail Mohammed | [asifsmohammed](https://github.com/asifsmohammed) | Amazon |
|
11
|
+
| David Venable | [dlvenable](https://github.com/dlvenable) | Amazon |
|
12
|
+
| Hai Yan | [oeyh](https://github.com/oeyh) | Amazon |
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
## Emeritus
|
17
|
+
|
7
18
|
| Maintainer | GitHub ID | Affiliation |
|
8
19
|
| ----------------------- | ------------------------------------------- | ----------- |
|
9
20
|
| Jack Mazanec | [jmazanec15](https://github.com/jmazanec15) | Amazon |
|
10
21
|
| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon |
|
11
22
|
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
|
12
23
|
| Deep Datta | [deepdatta](https://github.com/deepdatta) | Amazon |
|
13
|
-
| David Venable | [dlvenable](https://github.com/dlvenable) | Amazon |
|
14
24
|
| Shivani Shukla | [sshivanii](https://github.com/sshivanii) | Amazon |
|
@@ -12,6 +12,9 @@ require 'cgi'
|
|
12
12
|
require 'manticore'
|
13
13
|
require 'uri'
|
14
14
|
|
15
|
+
java_import 'org.apache.http.util.EntityUtils'
|
16
|
+
java_import 'org.apache.http.entity.StringEntity'
|
17
|
+
|
15
18
|
module LogStash; module Outputs; class OpenSearch; class HttpClient;
|
16
19
|
AWS_DEFAULT_PORT = 443
|
17
20
|
AWS_DEFAULT_PROFILE = 'default'
|
@@ -181,8 +184,20 @@ module LogStash; module Outputs; class OpenSearch; class HttpClient;
|
|
181
184
|
resp
|
182
185
|
end
|
183
186
|
|
187
|
+
# from Manticore, https://github.com/cheald/manticore/blob/acc25cac2999f4658a77a0f39f60ddbca8fe14a4/lib/manticore/client.rb#L536
|
188
|
+
ISO_8859_1 = "ISO-8859-1".freeze
|
189
|
+
|
190
|
+
def minimum_encoding_for(string)
|
191
|
+
if string.ascii_only?
|
192
|
+
ISO_8859_1
|
193
|
+
else
|
194
|
+
string.encoding.to_s
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
184
198
|
def sign_aws_request(request_uri, path, method, params)
|
185
199
|
url = URI::HTTPS.build({:host=>URI(request_uri.to_s).host, :port=>AWS_DEFAULT_PORT.to_s, :path=>path})
|
200
|
+
|
186
201
|
request = Seahorse::Client::Http::Request.new(options={:endpoint=>url, :http_method => method.to_s.upcase,
|
187
202
|
:headers => params[:headers],:body => params[:body]})
|
188
203
|
|
@@ -191,7 +206,8 @@ module LogStash; module Outputs; class OpenSearch; class HttpClient;
|
|
191
206
|
http_method: request.http_method,
|
192
207
|
url: url,
|
193
208
|
headers: params[:headers],
|
194
|
-
|
209
|
+
# match encoding of the HTTP adapter, see https://github.com/opensearch-project/logstash-output-opensearch/issues/207
|
210
|
+
body: params[:body] ? EntityUtils.toString(StringEntity.new(params[:body], minimum_encoding_for(params[:body]))) : nil
|
195
211
|
)
|
196
212
|
params[:headers] = params[:headers].merge(signed_key.headers)
|
197
213
|
end
|
@@ -70,35 +70,80 @@ describe LogStash::Outputs::OpenSearch::HttpClient::ManticoreAdapter do
|
|
70
70
|
} }
|
71
71
|
subject { described_class.new(logger, options) }
|
72
72
|
let(:uri) { ::LogStash::Util::SafeURI.new("http://localhost:9200") }
|
73
|
-
let(:sign_aws_request) { }
|
74
73
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
it "should validate AWS IAM service_name config" do
|
81
|
-
expect(subject.aws_iam_auth_initialization(options_svc)).not_to be_nil
|
82
|
-
expect(subject.get_service_name).to eq("svc_test")
|
83
|
-
end
|
74
|
+
let(:expected_uri) {
|
75
|
+
expected_uri = uri.clone
|
76
|
+
expected_uri.path = "/"
|
77
|
+
expected_uri
|
78
|
+
}
|
84
79
|
|
85
|
-
|
80
|
+
let(:resp) {
|
86
81
|
resp = double("response")
|
87
82
|
allow(resp).to receive(:call)
|
88
83
|
allow(resp).to receive(:code).and_return(200)
|
89
|
-
|
84
|
+
resp
|
85
|
+
}
|
90
86
|
|
91
|
-
|
92
|
-
|
87
|
+
context 'with a signer' do
|
88
|
+
let(:sign_aws_request) { }
|
93
89
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
90
|
+
it "should validate AWS IAM credentials initialization" do
|
91
|
+
expect(subject.aws_iam_auth_initialization(options)).not_to be_nil
|
92
|
+
expect(subject.get_service_name).to eq("es")
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should validate AWS IAM service_name config" do
|
96
|
+
expect(subject.aws_iam_auth_initialization(options_svc)).not_to be_nil
|
97
|
+
expect(subject.get_service_name).to eq("svc_test")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should validate signing aws request" do
|
101
|
+
allow(subject).to receive(:sign_aws_request).with(any_args).and_return(sign_aws_request)
|
102
|
+
|
103
|
+
expect(subject.manticore).to receive(:get).
|
104
|
+
with(expected_uri.to_s, {
|
105
|
+
:headers => {"content-type"=> "application/json"}
|
106
|
+
}
|
107
|
+
).and_return resp
|
108
|
+
|
109
|
+
expect(subject).to receive(:sign_aws_request)
|
110
|
+
subject.perform_request(uri, :get, "/")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'sign_aws_request' do
|
115
|
+
it 'handles UTF-8' do
|
116
|
+
encoded_body = body = "boîte de réception"
|
117
|
+
expect_any_instance_of(Aws::Sigv4::Signer).to receive(:sign_request).with(hash_including({
|
118
|
+
body: body,
|
119
|
+
})).and_return(
|
120
|
+
double(headers: {})
|
121
|
+
)
|
122
|
+
expect(subject.manticore).to receive(:post).
|
123
|
+
with(expected_uri.to_s, {
|
124
|
+
:body => encoded_body,
|
125
|
+
:headers => {"content-type"=> "application/json"}
|
126
|
+
}
|
98
127
|
).and_return resp
|
128
|
+
subject.perform_request(uri, :post, "/", { body: encoded_body })
|
129
|
+
end
|
99
130
|
|
100
|
-
|
101
|
-
|
131
|
+
it 'encodes body before signing to match manticore adapter encoding' do
|
132
|
+
body = "boîte de réception"
|
133
|
+
encoded_body = body.encode("ISO-8859-1")
|
134
|
+
expect_any_instance_of(Aws::Sigv4::Signer).to receive(:sign_request).with(hash_including({
|
135
|
+
body: body,
|
136
|
+
})).and_return(
|
137
|
+
double(headers: {})
|
138
|
+
)
|
139
|
+
expect(subject.manticore).to receive(:post).
|
140
|
+
with(expected_uri.to_s, {
|
141
|
+
:body => encoded_body,
|
142
|
+
:headers => {"content-type"=> "application/json"}
|
143
|
+
}
|
144
|
+
).and_return resp
|
145
|
+
subject.perform_request(uri, :post, "/", { body: encoded_body })
|
146
|
+
end
|
102
147
|
end
|
103
148
|
end
|
104
149
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-opensearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
@@ -11,9 +11,9 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
14
|
+
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYDVQQDDApvcGVu
|
15
15
|
c2VhcmNoMRYwFAYKCZImiZPyLGQBGRYGYW1hem9uMRMwEQYKCZImiZPyLGQBGRYD
|
16
|
-
|
16
|
+
Y29tMB4XDTIzMDgyNDIwNDIwNFoXDTI0MDgyMzIwNDIwNFowQjETMBEGA1UEAwwK
|
17
17
|
b3BlbnNlYXJjaDEWMBQGCgmSJomT8ixkARkWBmFtYXpvbjETMBEGCgmSJomT8ixk
|
18
18
|
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM1z3/jcitjV
|
19
19
|
umXwRFn+JSBBd36qZB54Dtucf6+E2fmNPzBRhgYN5XJy/+clQJ9NIJV7C8H52P3V
|
@@ -24,14 +24,14 @@ cert_chain:
|
|
24
24
|
zfR37/NQFkECAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
25
25
|
BBYEFJJ2myhLXK742btavNbG0IWrMNBIMCAGA1UdEQQZMBeBFW9wZW5zZWFyY2hA
|
26
26
|
YW1hem9uLmNvbTAgBgNVHRIEGTAXgRVvcGVuc2VhcmNoQGFtYXpvbi5jb20wDQYJ
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
KoZIhvcNAQELBQADggEBABAQpnELuY5AgdNUIlIVRVATO6iZOXTbt3a9oVbQdLPe
|
28
|
+
BfMObZyJydg0+leyR3oFyN9ZIFiEFwpd0biFf39DuC0M6Oge0Rv4oO9GRI3yyv77
|
29
|
+
9m59he+5DI3hbqtGje108oqRe61NZMlKcy/DCBVkzzZFsJ17GC09tY/gwhmNRtLV
|
30
|
+
3vYIEY6vmn57wrGn1NUzWdG+x/XVjYPw5Kwo+/rCxxZqpVTklMqVWV43N/lFrUOe
|
31
|
+
1DlemA1SsUBIoF7CwtVd/RTG/K1iT6nBD08fdKxodMhI5ujkP3N7gkxzRf6aKN4z
|
32
|
+
glnDJYZjluKBUsKTOLdPW1CZpb0AHLpNqDf8SVHsPFk=
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2023-
|
34
|
+
date: 2023-08-25 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -307,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
307
307
|
- !ruby/object:Gem::Version
|
308
308
|
version: '0'
|
309
309
|
requirements: []
|
310
|
-
rubygems_version: 3.3.
|
310
|
+
rubygems_version: 3.3.26
|
311
311
|
signing_key:
|
312
312
|
specification_version: 4
|
313
313
|
summary: Stores logs in OpenSearch
|
metadata.gz.sig
CHANGED
Binary file
|