logstash-output-elasticsearch 12.0.4-java → 12.0.6-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 +4 -4
- data/CHANGELOG.md +6 -0
- data/docs/index.asciidoc +4 -4
- data/lib/logstash/outputs/elasticsearch/http_client.rb +17 -5
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/fixtures/test_certs/GENERATED_AT +1 -1
- data/spec/fixtures/test_certs/ca.crt +30 -27
- data/spec/fixtures/test_certs/ca.der.sha256 +1 -1
- data/spec/fixtures/test_certs/renew.sh +2 -3
- data/spec/fixtures/test_certs/test.crt +29 -28
- data/spec/fixtures/test_certs/test.der.sha256 +1 -1
- data/spec/fixtures/test_certs/test.p12 +0 -0
- data/spec/integration/outputs/compressed_indexing_spec.rb +3 -1
- data/spec/integration/outputs/index_spec.rb +12 -2
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +77 -0
- data/spec/unit/outputs/elasticsearch_spec.rb +1 -1
- metadata +18 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed4936a4ade53b1bfabb21a6a217a2587ee38235a3219be044ca59a664fd25a1
|
4
|
+
data.tar.gz: c06797095dd77c26bd7c70d1d851fcc50ca8e2b4db35485e9f5c018941e54cd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163f1e9cd1127527b6ce207f18f451c6dfd7510c6f752739908d6804c3fa70b2fced78b22668f6388d02a92d9969dd7f47f079e0180abacf8f0305d56ad14441
|
7
|
+
data.tar.gz: 77dc391a2d5ef77f76d07a52b6f00375eb6b9ffb9c8dbb731c849b2bffd8fb25f819c3070a729a9f1c72e7ba4ff845359ba5109aa2e5eb1242461c4b0cab5719
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 12.0.6
|
2
|
+
- Add headers reporting uncompressed size and doc count for bulk requests [#1217](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1217)
|
3
|
+
|
4
|
+
## 12.0.5
|
5
|
+
- [DOC] Fix link to Logstash DLQ docs [#1214](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1214)
|
6
|
+
|
1
7
|
## 12.0.4
|
2
8
|
- [DOC] Update Cloud terminology [#1212](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1212)
|
3
9
|
|
data/docs/index.asciidoc
CHANGED
@@ -190,7 +190,7 @@ Example:
|
|
190
190
|
}
|
191
191
|
|
192
192
|
|
193
|
-
==== Retry
|
193
|
+
==== Retry policy
|
194
194
|
|
195
195
|
The retry policy has changed significantly in the 8.1.1 release.
|
196
196
|
This plugin uses the Elasticsearch bulk API to optimize its imports into Elasticsearch. These requests may experience
|
@@ -223,7 +223,7 @@ Note that 409 exceptions are no longer retried. Please set a higher `retry_on_co
|
|
223
223
|
It is more performant for Elasticsearch to retry these exceptions than this plugin.
|
224
224
|
|
225
225
|
[id="plugins-{type}s-{plugin}-dlq-policy"]
|
226
|
-
==== DLQ
|
226
|
+
==== DLQ policy
|
227
227
|
|
228
228
|
Mapping (404) errors from Elasticsearch can lead to data loss. Unfortunately
|
229
229
|
mapping errors cannot be handled without human intervention and without looking
|
@@ -231,8 +231,8 @@ at the field that caused the mapping mismatch. If the DLQ is enabled, the
|
|
231
231
|
original events causing the mapping errors are stored in a file that can be
|
232
232
|
processed at a later time. Often times, the offending field can be removed and
|
233
233
|
re-indexed to Elasticsearch. If the DLQ is not enabled, and a mapping error
|
234
|
-
happens, the problem is logged as a warning, and the event is dropped.
|
235
|
-
|
234
|
+
happens, the problem is logged as a warning, and the event is dropped.
|
235
|
+
Check out https://www.elastic.co/guide/en/logstash/current/dead-letter-queues.html[Dead letter queues (DLQ)] for more information about processing events in the DLQ.
|
236
236
|
The list of error codes accepted for DLQ could be customized with <<plugins-{type}s-{plugin}-dlq_custom_codes>>
|
237
237
|
but should be used only in motivated cases.
|
238
238
|
|
@@ -21,7 +21,8 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
21
21
|
# We wound up agreeing that a number greater than 10 MiB and less than 100MiB
|
22
22
|
# made sense. We picked one on the lowish side to not use too much heap.
|
23
23
|
TARGET_BULK_BYTES = 20 * 1024 * 1024 # 20MiB
|
24
|
-
|
24
|
+
EVENT_COUNT_HEADER = "X-Elastic-Event-Count".freeze
|
25
|
+
UNCOMPRESSED_LENGTH_HEADER = "X-Elastic-Uncompressed-Request-Length".freeze
|
25
26
|
|
26
27
|
class HttpClient
|
27
28
|
attr_reader :client, :options, :logger, :pool, :action_count, :recv_count
|
@@ -143,7 +144,11 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
143
144
|
:payload_size => stream_writer.pos,
|
144
145
|
:content_length => body_stream.size,
|
145
146
|
:batch_offset => (index + 1 - batch_actions.size))
|
146
|
-
|
147
|
+
headers = {
|
148
|
+
EVENT_COUNT_HEADER => batch_actions.size.to_s,
|
149
|
+
UNCOMPRESSED_LENGTH_HEADER => stream_writer.pos.to_s
|
150
|
+
}
|
151
|
+
bulk_responses << bulk_send(body_stream, batch_actions, headers)
|
147
152
|
body_stream.truncate(0) && body_stream.seek(0)
|
148
153
|
stream_writer = gzip_writer(body_stream) if compression_level?
|
149
154
|
batch_actions.clear
|
@@ -159,7 +164,14 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
159
164
|
:payload_size => stream_writer.pos,
|
160
165
|
:content_length => body_stream.size,
|
161
166
|
:batch_offset => (actions.size - batch_actions.size))
|
162
|
-
|
167
|
+
|
168
|
+
if body_stream.size > 0
|
169
|
+
headers = {
|
170
|
+
EVENT_COUNT_HEADER => batch_actions.size.to_s,
|
171
|
+
UNCOMPRESSED_LENGTH_HEADER => stream_writer.pos.to_s
|
172
|
+
}
|
173
|
+
bulk_responses << bulk_send(body_stream, batch_actions, headers)
|
174
|
+
end
|
163
175
|
|
164
176
|
body_stream.close unless compression_level?
|
165
177
|
join_bulk_responses(bulk_responses)
|
@@ -179,8 +191,8 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
179
191
|
}
|
180
192
|
end
|
181
193
|
|
182
|
-
def bulk_send(body_stream, batch_actions)
|
183
|
-
params = compression_level? ? {:headers =>
|
194
|
+
def bulk_send(body_stream, batch_actions, headers = {})
|
195
|
+
params = compression_level? ? {:headers => headers.merge("Content-Encoding" => "gzip") } : { :headers => headers }
|
184
196
|
|
185
197
|
begin
|
186
198
|
response = @pool.post(@bulk_path, params, body_stream.string)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '12.0.
|
3
|
+
s.version = '12.0.6'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Stores logs in Elasticsearch"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2025-07-22T11:15:03+01:00
|
@@ -1,29 +1,32 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
2
|
+
MIIFdTCCA12gAwIBAgIUDITbsLT9hKser0ZzBZsxqgaZdWswDQYJKoZIhvcNAQEL
|
3
|
+
BQAwSjELMAkGA1UEBhMCUFQxCzAJBgNVBAgMAk5BMQ8wDQYDVQQHDAZMaXNib24x
|
4
|
+
DjAM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if1BrhYZ0iu8o
|
19
|
+
2z8rMB8GA1UdIwQYMBaAFKFadJx46upif1BrhYZ0iu8o2z8rMA8GA1UdEwEB/wQF
|
20
|
+
MAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJi4FwYJz/RotoUpfrLZFf69RoI01Fje
|
21
|
+
8ITt8SR1Dx/1GTPEuqVVfx0EYtOoH6Gg3FwgSQ9GHRDIa1vkHY5S+FUSOW3pCoZE
|
22
|
+
/kaLu9bmFxn+GntghvQEor+LzODuZKLXupaGcu1tA4fzyuI4jglVD2sGZtLk//CT
|
23
|
+
Hd4tOWXo5k1Fj0jMnJq+2Htr8yBeSAO5ZNsvtAjOUU6pfDEwL9bgRzlKKFQQMUYo
|
24
|
+
6x1FvRDRXWjpzB/H+OSqOaoNLEB9FfEl8I7nn6uTenr5WxjPAOpwjZl9ObB/95xM
|
25
|
+
p91abKbLQLev5I8npM9G3C/n01l3IzRs7DNHqGJTZO7frGhicD7/jNa+tkSioeJ2
|
26
|
+
fIMqgDOvQE+gMxs19zw1tsI3+kqX7+ptTkU4Lan5V5ZKGfU8xtcVIlyRk5/yDUI5
|
27
|
+
1dfQVubs6z07s6De2qa92LFz9l8sT6QuVer+c/wPPhBdMwbzcHyUJIBjFaBpxH86
|
28
|
+
F7Mr5Zr/+qcbHglAHow1lBqdZzimqGd1koqFRat/pFUFh0iqktMmpl+ZUCjyoQEX
|
29
|
+
93j8aMU2UQjYM8NJDE2aRculo9OEoqERYFM2m3nHvrtE7iZgddryLNH7ZmC1EquX
|
30
|
+
MhZJ26GuZ2U4b9dAX858WTv0q1EF5S8KObMlxMU7IDk+cWlSD+puWliwfUKoTR/4
|
31
|
+
JErSfjCSaRqh
|
29
32
|
-----END CERTIFICATE-----
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
d403930d5296f1515aadd3f730757e7719188b63a276687a3475128b746e4340
|
@@ -3,8 +3,7 @@
|
|
3
3
|
set -e
|
4
4
|
cd "$(dirname "$0")"
|
5
5
|
|
6
|
-
openssl x509 -
|
7
|
-
openssl x509 -req -days 365 -in ca.csr -set_serial 0x01 -signkey ca.key -out ca.crt && rm ca.csr
|
6
|
+
openssl req -x509 -new -nodes -key ca.key -subj "/C=PT/ST=NA/L=Lisbon/O=MyLab/CN=root" -sha256 -days 3650 -out ca.crt
|
8
7
|
openssl x509 -in ca.crt -outform der | sha256sum | awk '{print $1}' > ca.der.sha256
|
9
8
|
|
10
9
|
openssl x509 -x509toreq -in test.crt -signkey test.key -out test.csr
|
@@ -13,4 +12,4 @@ openssl x509 -in test.crt -outform der | sha256sum | awk '{print $1}' > test.der
|
|
13
12
|
openssl pkcs12 -export -inkey test.key -in test.crt -passout "pass:1234567890" -out test.p12
|
14
13
|
|
15
14
|
# output ISO8601 timestamp to file
|
16
|
-
date -Iseconds > GENERATED_AT
|
15
|
+
date -Iseconds > GENERATED_AT
|
@@ -1,30 +1,31 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
2
|
+
MIIFWjCCA0KgAwIBAgIBATANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQGEwJQVDEL
|
3
|
+
MAkGA1UECAwCTkExDzANBgNVBAcMBkxpc2JvbjEOMAwGA1UECgwFTXlMYWIxDTAL
|
4
|
+
BgNVBAMMBHJvb3QwHhcNMjUwNzIyMTAxNTAzWhcNMjYwNzIyMTAxNTAzWjBTMQsw
|
5
|
+
CQYDVQQGEwJQVDELMAkGA1UECAwCTkExDzANBgNVBAcMBkxpc2JvbjEOMAwGA1UE
|
6
|
+
CgwFTXlMYWIxFjAUBg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u
|
21
|
+
vhjC88bewiKVHldqkC6ju9rbZxQynhFZGXbN9zLvFMZGkfRH5vB2Y13ZWBdWhq5L
|
22
|
+
cRxpRk6WlwaSy0Ed4F12u9ERmhMOtSZhqAnNJBeVraOHeGlcMZXJdZkeyxkdcZ4y
|
23
|
+
YJcrI8Da0dMxILgIuc9ZCynAItRAjMw1/3wjlx0Cyxif10ct+EFiP6Zv/gzoo05v
|
24
|
+
tNeqOCrxAqAcwrS1u4q/KAKySiEIyxyU1nEI/g53nALwoQhFsRVqVXNAoy7xu37y
|
25
|
+
o+lvs98rkq/NkkbBvRBPdcF/BYNtesRxKja/QAEvslyZfyICL9oqsuPPEB2nHtXa
|
26
|
+
mWntT2NaXyr1FWCxHaXfZQOxSwco3vTk7HLuNug2wxIc/hewkLlk5NCRkAYfTlan
|
27
|
+
gLhZ3vBej4oA8cdpODMb8SrYhqKTeX8E+ulHVS0paY0kszAGK2x2kHqRGNXUlfoB
|
28
|
+
Ax0etGudHhgtTCAmUgJDyQNLkvBKHYQJ2V/Wv/xej7wXKkACNKlRORl8zcnbVErd
|
29
|
+
GM/ibfqNIPIo8dP2EDycSV6vIICqkxpCZZObNjfgKa0UN03qYi7xREhhEehXgU8H
|
30
|
+
IO9w2pG7ReiO2E+bLIs0Zh1+2IwlM1EM/eqbq+Gi
|
30
31
|
-----END CERTIFICATE-----
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
386ae6ef809d20ddfcc7ca68f480e82007c031b365c86cc58922cf1bd7238f89
|
Binary file
|
@@ -36,7 +36,9 @@ end
|
|
36
36
|
{
|
37
37
|
"Content-Encoding" => "gzip",
|
38
38
|
"Content-Type" => "application/json",
|
39
|
-
'x-elastic-product-origin' => 'logstash-output-elasticsearch'
|
39
|
+
'x-elastic-product-origin' => 'logstash-output-elasticsearch',
|
40
|
+
'X-Elastic-Event-Count' => anything,
|
41
|
+
'X-Elastic-Uncompressed-Request-Length' => anything,
|
40
42
|
}
|
41
43
|
}
|
42
44
|
|
@@ -215,12 +215,22 @@ describe "indexing" do
|
|
215
215
|
|
216
216
|
it "sets the correct content-type header" do
|
217
217
|
expected_manticore_opts = {
|
218
|
-
:headers => {
|
218
|
+
:headers => {
|
219
|
+
"Content-Type" => "application/json",
|
220
|
+
'x-elastic-product-origin' => 'logstash-output-elasticsearch',
|
221
|
+
'X-Elastic-Event-Count' => anything,
|
222
|
+
'X-Elastic-Uncompressed-Request-Length' => anything
|
223
|
+
},
|
219
224
|
:body => anything
|
220
225
|
}
|
221
226
|
if secure
|
222
227
|
expected_manticore_opts = {
|
223
|
-
:headers => {
|
228
|
+
:headers => {
|
229
|
+
"Content-Type" => "application/json",
|
230
|
+
'x-elastic-product-origin' => 'logstash-output-elasticsearch',
|
231
|
+
'X-Elastic-Event-Count' => anything,
|
232
|
+
'X-Elastic-Uncompressed-Request-Length' => anything
|
233
|
+
},
|
224
234
|
:body => anything,
|
225
235
|
:auth => {
|
226
236
|
:user => user,
|
@@ -270,6 +270,83 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
|
|
270
270
|
|
271
271
|
end
|
272
272
|
end
|
273
|
+
context "the 'user-agent' header" do
|
274
|
+
let(:pool) { double("pool") }
|
275
|
+
let(:compression_level) { 6 }
|
276
|
+
let(:base_options) { super().merge( :client_settings => {:compression_level => compression_level}) }
|
277
|
+
let(:actions) { [
|
278
|
+
["index", {:_id=>nil, :_index=>"logstash"}, {"message_1"=> message_1}],
|
279
|
+
["index", {:_id=>nil, :_index=>"logstash"}, {"message_2"=> message_2}],
|
280
|
+
["index", {:_id=>nil, :_index=>"logstash"}, {"message_3"=> message_3}],
|
281
|
+
]}
|
282
|
+
let(:message_1) { "hello" }
|
283
|
+
let(:message_2_size) { 1_000 }
|
284
|
+
let(:message_2) { SecureRandom.alphanumeric(message_2_size / 2 ) * 2 }
|
285
|
+
let(:message_3_size) { 1_000 }
|
286
|
+
let(:message_3) { "m" * message_3_size }
|
287
|
+
let(:messages_size) { message_1.size + message_2.size + message_3.size }
|
288
|
+
let(:action_overhead) { 42 + 16 + 2 } # header plus doc key size plus new line overhead per action
|
289
|
+
|
290
|
+
let(:response) do
|
291
|
+
response = double("response")
|
292
|
+
allow(response).to receive(:code).and_return(response)
|
293
|
+
allow(response).to receive(:body).and_return({"errors" => false}.to_json)
|
294
|
+
response
|
295
|
+
end
|
296
|
+
|
297
|
+
before(:each) do
|
298
|
+
subject.instance_variable_set("@pool", pool)
|
299
|
+
end
|
300
|
+
|
301
|
+
it "carries bulk request's uncompressed size" do
|
302
|
+
expect(pool).to receive(:post) do |path, params, body|
|
303
|
+
headers = params.fetch(:headers, {})
|
304
|
+
expect(headers["X-Elastic-Event-Count"]).to eq("3")
|
305
|
+
expect(headers["X-Elastic-Uncompressed-Request-Length"]).to eq (messages_size + (action_overhead * 3)).to_s
|
306
|
+
end.and_return(response)
|
307
|
+
|
308
|
+
subject.send(:bulk, actions)
|
309
|
+
end
|
310
|
+
context "without compression" do
|
311
|
+
let(:compression_level) { 0 }
|
312
|
+
it "carries bulk request's uncompressed size" do
|
313
|
+
expect(pool).to receive(:post) do |path, params, body|
|
314
|
+
headers = params.fetch(:headers, {})
|
315
|
+
expect(headers["X-Elastic-Event-Count"]).to eq("3")
|
316
|
+
expect(headers["X-Elastic-Uncompressed-Request-Length"]).to eq (messages_size + (action_overhead * 3)).to_s
|
317
|
+
end.and_return(response)
|
318
|
+
subject.send(:bulk, actions)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
context "with compressed messages over 20MB" do
|
323
|
+
let(:message_2_size) { 21_000_000 }
|
324
|
+
it "carries bulk request's uncompressed size" do
|
325
|
+
# only the first, tiny, message is sent first
|
326
|
+
expect(pool).to receive(:post) do |path, params, body|
|
327
|
+
headers = params.fetch(:headers, {})
|
328
|
+
expect(headers["X-Elastic-Uncompressed-Request-Length"]).to eq (message_1.size + action_overhead).to_s
|
329
|
+
expect(headers["X-Elastic-Event-Count"]).to eq("1")
|
330
|
+
end.and_return(response)
|
331
|
+
|
332
|
+
# huge message_2 is sent afterwards alone
|
333
|
+
expect(pool).to receive(:post) do |path, params, body|
|
334
|
+
headers = params.fetch(:headers, {})
|
335
|
+
expect(headers["X-Elastic-Uncompressed-Request-Length"]).to eq (message_2.size + action_overhead).to_s
|
336
|
+
expect(headers["X-Elastic-Event-Count"]).to eq("1")
|
337
|
+
end.and_return(response)
|
338
|
+
|
339
|
+
# finally medium message_3 is sent alone as well
|
340
|
+
expect(pool).to receive(:post) do |path, params, body|
|
341
|
+
headers = params.fetch(:headers, {})
|
342
|
+
expect(headers["X-Elastic-Uncompressed-Request-Length"]).to eq (message_3.size + action_overhead).to_s
|
343
|
+
expect(headers["X-Elastic-Event-Count"]).to eq("1")
|
344
|
+
end.and_return(response)
|
345
|
+
|
346
|
+
subject.send(:bulk, actions)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
273
350
|
end
|
274
351
|
|
275
352
|
describe "sniffing" do
|
@@ -770,7 +770,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
770
770
|
end
|
771
771
|
|
772
772
|
before(:each) do
|
773
|
-
allow(subject.client).to receive(:bulk_send).with(instance_of(StringIO), instance_of(Array)) do |stream, actions|
|
773
|
+
allow(subject.client).to receive(:bulk_send).with(instance_of(StringIO), instance_of(Array), instance_of(Hash)) do |stream, actions, headers|
|
774
774
|
expect( stream.string ).to include '"foo":"bar1"'
|
775
775
|
expect( stream.string ).to include '"foo":"bar2"'
|
776
776
|
end.and_return(bulk_response, {"errors"=>false}) # let's make it go away (second call) to not retry indefinitely
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.0.
|
4
|
+
version: 12.0.6
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
10
|
+
date: 2025-07-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
13
|
+
name: manticore
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
@@ -19,7 +19,6 @@ dependencies:
|
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 1.0.0
|
22
|
-
name: manticore
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,6 +30,7 @@ dependencies:
|
|
31
30
|
- !ruby/object:Gem::Version
|
32
31
|
version: 1.0.0
|
33
32
|
- !ruby/object:Gem::Dependency
|
33
|
+
name: stud
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
36
|
- - ">="
|
@@ -39,7 +39,6 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0.0'
|
42
|
-
name: stud
|
43
42
|
type: :runtime
|
44
43
|
prerelease: false
|
45
44
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,6 +50,7 @@ dependencies:
|
|
51
50
|
- !ruby/object:Gem::Version
|
52
51
|
version: '0.0'
|
53
52
|
- !ruby/object:Gem::Dependency
|
53
|
+
name: logstash-core-plugin-api
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - ">="
|
@@ -59,7 +59,6 @@ dependencies:
|
|
59
59
|
- - "<="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.99'
|
62
|
-
name: logstash-core-plugin-api
|
63
62
|
type: :runtime
|
64
63
|
prerelease: false
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -71,12 +70,12 @@ dependencies:
|
|
71
70
|
- !ruby/object:Gem::Version
|
72
71
|
version: '2.99'
|
73
72
|
- !ruby/object:Gem::Dependency
|
73
|
+
name: logstash-mixin-ecs_compatibility_support
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
76
|
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '1.0'
|
79
|
-
name: logstash-mixin-ecs_compatibility_support
|
80
79
|
type: :runtime
|
81
80
|
prerelease: false
|
82
81
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -85,12 +84,12 @@ dependencies:
|
|
85
84
|
- !ruby/object:Gem::Version
|
86
85
|
version: '1.0'
|
87
86
|
- !ruby/object:Gem::Dependency
|
87
|
+
name: logstash-mixin-deprecation_logger_support
|
88
88
|
requirement: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
90
|
- - "~>"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '1.0'
|
93
|
-
name: logstash-mixin-deprecation_logger_support
|
94
93
|
type: :runtime
|
95
94
|
prerelease: false
|
96
95
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -99,12 +98,12 @@ dependencies:
|
|
99
98
|
- !ruby/object:Gem::Version
|
100
99
|
version: '1.0'
|
101
100
|
- !ruby/object:Gem::Dependency
|
101
|
+
name: logstash-mixin-ca_trusted_fingerprint_support
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '1.0'
|
107
|
-
name: logstash-mixin-ca_trusted_fingerprint_support
|
108
107
|
type: :runtime
|
109
108
|
prerelease: false
|
110
109
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -113,12 +112,12 @@ dependencies:
|
|
113
112
|
- !ruby/object:Gem::Version
|
114
113
|
version: '1.0'
|
115
114
|
- !ruby/object:Gem::Dependency
|
115
|
+
name: logstash-mixin-normalize_config_support
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - "~>"
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '1.0'
|
121
|
-
name: logstash-mixin-normalize_config_support
|
122
121
|
type: :runtime
|
123
122
|
prerelease: false
|
124
123
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -127,12 +126,12 @@ dependencies:
|
|
127
126
|
- !ruby/object:Gem::Version
|
128
127
|
version: '1.0'
|
129
128
|
- !ruby/object:Gem::Dependency
|
129
|
+
name: logstash-codec-plain
|
130
130
|
requirement: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
|
-
name: logstash-codec-plain
|
136
135
|
type: :development
|
137
136
|
prerelease: false
|
138
137
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -141,12 +140,12 @@ dependencies:
|
|
141
140
|
- !ruby/object:Gem::Version
|
142
141
|
version: '0'
|
143
142
|
- !ruby/object:Gem::Dependency
|
143
|
+
name: logstash-devutils
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
146
|
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
|
-
name: logstash-devutils
|
150
149
|
type: :development
|
151
150
|
prerelease: false
|
152
151
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -155,12 +154,12 @@ dependencies:
|
|
155
154
|
- !ruby/object:Gem::Version
|
156
155
|
version: '0'
|
157
156
|
- !ruby/object:Gem::Dependency
|
157
|
+
name: flores
|
158
158
|
requirement: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
160
|
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
|
-
name: flores
|
164
163
|
type: :development
|
165
164
|
prerelease: false
|
166
165
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -169,12 +168,12 @@ dependencies:
|
|
169
168
|
- !ruby/object:Gem::Version
|
170
169
|
version: '0'
|
171
170
|
- !ruby/object:Gem::Dependency
|
171
|
+
name: cabin
|
172
172
|
requirement: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
174
|
- - "~>"
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: '0.6'
|
177
|
-
name: cabin
|
178
177
|
type: :development
|
179
178
|
prerelease: false
|
180
179
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -183,12 +182,12 @@ dependencies:
|
|
183
182
|
- !ruby/object:Gem::Version
|
184
183
|
version: '0.6'
|
185
184
|
- !ruby/object:Gem::Dependency
|
185
|
+
name: webrick
|
186
186
|
requirement: !ruby/object:Gem::Requirement
|
187
187
|
requirements:
|
188
188
|
- - ">="
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
|
-
name: webrick
|
192
191
|
type: :development
|
193
192
|
prerelease: false
|
194
193
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -197,12 +196,12 @@ dependencies:
|
|
197
196
|
- !ruby/object:Gem::Version
|
198
197
|
version: '0'
|
199
198
|
- !ruby/object:Gem::Dependency
|
199
|
+
name: webmock
|
200
200
|
requirement: !ruby/object:Gem::Requirement
|
201
201
|
requirements:
|
202
202
|
- - ">="
|
203
203
|
- !ruby/object:Gem::Version
|
204
204
|
version: '0'
|
205
|
-
name: webmock
|
206
205
|
type: :development
|
207
206
|
prerelease: false
|
208
207
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -211,12 +210,12 @@ dependencies:
|
|
211
210
|
- !ruby/object:Gem::Version
|
212
211
|
version: '0'
|
213
212
|
- !ruby/object:Gem::Dependency
|
213
|
+
name: rspec-collection_matchers
|
214
214
|
requirement: !ruby/object:Gem::Requirement
|
215
215
|
requirements:
|
216
216
|
- - ">="
|
217
217
|
- !ruby/object:Gem::Version
|
218
218
|
version: '0'
|
219
|
-
name: rspec-collection_matchers
|
220
219
|
type: :development
|
221
220
|
prerelease: false
|
222
221
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -225,12 +224,12 @@ dependencies:
|
|
225
224
|
- !ruby/object:Gem::Version
|
226
225
|
version: '0'
|
227
226
|
- !ruby/object:Gem::Dependency
|
227
|
+
name: elasticsearch
|
228
228
|
requirement: !ruby/object:Gem::Requirement
|
229
229
|
requirements:
|
230
230
|
- - ">="
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: '0'
|
233
|
-
name: elasticsearch
|
234
233
|
type: :development
|
235
234
|
prerelease: false
|
236
235
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -341,7 +340,6 @@ licenses:
|
|
341
340
|
metadata:
|
342
341
|
logstash_plugin: 'true'
|
343
342
|
logstash_group: output
|
344
|
-
post_install_message:
|
345
343
|
rdoc_options: []
|
346
344
|
require_paths:
|
347
345
|
- lib
|
@@ -356,8 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
354
|
- !ruby/object:Gem::Version
|
357
355
|
version: '0'
|
358
356
|
requirements: []
|
359
|
-
rubygems_version: 3.3
|
360
|
-
signing_key:
|
357
|
+
rubygems_version: 3.6.3
|
361
358
|
specification_version: 4
|
362
359
|
summary: Stores logs in Elasticsearch
|
363
360
|
test_files:
|