logstash-output-opensearch 2.0.1-java → 2.0.2-java

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: e66800b300125b8b99d1425526e5f0f7661303b7a56dd25e6177a0780b9d5631
4
- data.tar.gz: 77228ee0c56dca37f849023fa2159c52c4125b1dbf9fda6cf269ec489417d0d7
3
+ metadata.gz: a9700db92f60b264d7edf26bb34281f9fac13c27d93564d80ce007e5e7b73928
4
+ data.tar.gz: a4feb8d63b747cd2db45ec1b47df5e30a6aea6dbee3a30dde51c94773b192ec8
5
5
  SHA512:
6
- metadata.gz: 9ee5db1f3d9ed8275a3329538d2b82c8a30db156c375fed8d250874511a29da8fe020019fb4b106caf42c3d0ad9b7c8136aa3312d307b45047930dceae0eebd4
7
- data.tar.gz: bfa35bf7dd1e5621cf04f7a5b8f9d79d4bdbda2529f1d7cd697a6723b3487cb507079acc89dee1e075309b80eccd72984bffc3c96bcb23a2cc7a1739d68da592
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
- body: params[:body]
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
@@ -11,7 +11,7 @@ signing_key_path = "gem-private_key.pem"
11
11
 
12
12
  Gem::Specification.new do |s|
13
13
  s.name = 'logstash-output-opensearch'
14
- s.version = '2.0.1'
14
+ s.version = '2.0.2'
15
15
 
16
16
  s.licenses = ['Apache-2.0']
17
17
  s.summary = "Stores logs in OpenSearch"
@@ -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
- it "should validate AWS IAM credentials initialization" do
76
- expect(subject.aws_iam_auth_initialization(options)).not_to be_nil
77
- expect(subject.get_service_name).to eq("es")
78
- end
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
- it "should validate signing aws request" do
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
- allow(subject).to receive(:sign_aws_request).with(any_args).and_return(sign_aws_request)
84
+ resp
85
+ }
90
86
 
91
- expected_uri = uri.clone
92
- expected_uri.path = "/"
87
+ context 'with a signer' do
88
+ let(:sign_aws_request) { }
93
89
 
94
- expect(subject.manticore).to receive(:get).
95
- with(expected_uri.to_s, {
96
- :headers => {"content-type"=> "application/json"}
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
- expect(subject).to receive(:sign_aws_request)
101
- subject.perform_request(uri, :get, "/")
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.1
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
- MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRMwEQYDVQQDDApvcGVu
14
+ MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQsFADBCMRMwEQYDVQQDDApvcGVu
15
15
  c2VhcmNoMRYwFAYKCZImiZPyLGQBGRYGYW1hem9uMRMwEQYKCZImiZPyLGQBGRYD
16
- Y29tMB4XDTIyMDgxNzE3NTIzNFoXDTIzMDgxNzE3NTIzNFowQjETMBEGA1UEAwwK
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
- KoZIhvcNAQEFBQADggEBAH5pWLYwKWFh1OjdCReGz/VEAiF4jXXputoN5Z8ga+1Z
28
- lg8/diJf0PlP2B46PdmxH/TVc/o+qglNO2cHVEp8xZfEd83dfioOBeK90URQUpC5
29
- UZmO0LZusg46SQKwKa2ukpIy2fNi3PeHRiV+W2Zv69GoWppyLun+fMez7wVoah2r
30
- r5ROUYuAvFUvga1Vm+49pKiPM5n+MAYP5t/vWhgymY3SYQ1TfewkvKAFiFXikOR+
31
- r+j7FLyKuk5DzIxiCp8QN5dU71BbGUmsHf/C5UV76WLPOFX/szeaHhPwpjR3sK7r
32
- 5zLgCV1KP7cgDdCYMlmZGeSViU8NV+Yy8/ghrzGpqVw=
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-02-02 00:00:00.000000000 Z
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.25
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