logstash-input-http 4.2.2-java → 4.3.0-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 +3 -0
- data/VERSION +1 -1
- data/docs/index.asciidoc +25 -0
- data/lib/logstash/inputs/http.rb +5 -1
- data/lib/logstash-input-http_jars.rb +1 -1
- data/spec/inputs/http_spec.rb +131 -0
- data/vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.3.0/logstash-input-http-4.3.0.jar +0 -0
- metadata +4 -4
- data/vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.2.2/logstash-input-http-4.2.2.jar +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 490f81a4b59801fef5b63c4f86fb56de55dabc93b1b931e2c9c279185b4d1f03
|
|
4
|
+
data.tar.gz: 28aac8ea13a7da36556d36251fbf33f173295f18e6200db357e9cbee40658e10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2361f5b1665d3d90ea2302ab81644323526ef78ec6e589ec3d7cc21ec96fe85197923db0477f5c73c32dec51f53ab0eca2a89e71ecae438bc7579c6d7a664ea3
|
|
7
|
+
data.tar.gz: 0fec1e380323f131602ad35302c6b4f97f211352805d17c016e2ed2a9605fba7fa143f27e7862986673324b4abebb1cac4d0534a432f186d74b967b0fa5894ca
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.3.0
|
data/docs/index.asciidoc
CHANGED
|
@@ -137,6 +137,7 @@ Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
|
|
|
137
137
|
| <<plugins-{type}s-{plugin}-max_pending_requests>> |<<number,number>>|No
|
|
138
138
|
| <<plugins-{type}s-{plugin}-response_headers>> |<<hash,hash>>|No
|
|
139
139
|
| <<plugins-{type}s-{plugin}-response_code>> |<<number,number>>, one of `[200, 201, 202, 204]`|No
|
|
140
|
+
| <<plugins-{type}s-{plugin}-response_content>> |<<string,string>>|No
|
|
140
141
|
| <<plugins-{type}s-{plugin}-ssl_certificate>> |a valid filesystem path|No
|
|
141
142
|
| <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |<<array,array>>|No
|
|
142
143
|
| <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |<<array,array>>|No
|
|
@@ -295,6 +296,30 @@ invalid credentials (401), internal errors (503) or backpressure (429).
|
|
|
295
296
|
|
|
296
297
|
If 204 (No Content) is set, the response body will not be sent in the response.
|
|
297
298
|
|
|
299
|
+
[id="plugins-{type}s-{plugin}-response_content"]
|
|
300
|
+
===== `response_content`
|
|
301
|
+
|
|
302
|
+
* Value type is <<string,string>>
|
|
303
|
+
* Default value is `"ok"`
|
|
304
|
+
|
|
305
|
+
The body of the response returned when a request is processed successfully.
|
|
306
|
+
Combine with <<plugins-{type}s-{plugin}-response_headers>> when a client expects a specific
|
|
307
|
+
response format, for example:
|
|
308
|
+
|
|
309
|
+
[source,ruby]
|
|
310
|
+
input {
|
|
311
|
+
http {
|
|
312
|
+
response_content => '{"errors": false}'
|
|
313
|
+
response_headers => { "Content-Type" => "application/json" "X-Elastic-Product" => "Elasticsearch" }
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
The example above makes the response look like an Elasticsearch `_bulk` response, which is what the
|
|
318
|
+
OpenTelemetry Collector Elasticsearch exporter expects when it is pointed at this input.
|
|
319
|
+
The `X-Elastic-Product` header is required by the Elasticsearch client the exporter uses.
|
|
320
|
+
|
|
321
|
+
If 204 (No Content) is set as the <<plugins-{type}s-{plugin}-response_code>>, the response body will not be sent.
|
|
322
|
+
|
|
298
323
|
[id="plugins-{type}s-{plugin}-response_headers"]
|
|
299
324
|
===== `response_headers`
|
|
300
325
|
|
data/lib/logstash/inputs/http.rb
CHANGED
|
@@ -134,6 +134,10 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
134
134
|
|
|
135
135
|
config :response_code, :validate => [200, 201, 202, 204], :default => 200
|
|
136
136
|
|
|
137
|
+
# The body of the response returned when a request is processed successfully.
|
|
138
|
+
# Not sent when `response_code` is 204.
|
|
139
|
+
config :response_content, :validate => :string, :default => 'ok'
|
|
140
|
+
|
|
137
141
|
# Obsolete Settings
|
|
138
142
|
config :ssl, :obsolete => "Set 'ssl_enabled' instead."
|
|
139
143
|
config :keystore, :obsolete => "Set 'ssl_keystore_path' instead."
|
|
@@ -340,7 +344,7 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
|
|
|
340
344
|
def create_http_server(message_handler)
|
|
341
345
|
org.logstash.plugins.inputs.http.NettyHttpServer.new(
|
|
342
346
|
@id, @host, @port, message_handler, build_ssl_params, @threads,
|
|
343
|
-
@max_pending_requests, @max_content_length, @response_code)
|
|
347
|
+
@max_pending_requests, @max_content_length, @response_code, @response_content)
|
|
344
348
|
end
|
|
345
349
|
|
|
346
350
|
def build_ssl_params
|
|
@@ -9,4 +9,4 @@ require_jar('io.netty', 'netty-transport', '4.1.138.Final')
|
|
|
9
9
|
require_jar('io.netty', 'netty-buffer', '4.1.138.Final')
|
|
10
10
|
require_jar('io.netty', 'netty-resolver', '4.1.138.Final')
|
|
11
11
|
require_jar('io.netty', 'netty-common', '4.1.138.Final')
|
|
12
|
-
require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '4.
|
|
12
|
+
require_jar('org.logstash.plugins.input.http', 'logstash-input-http', '4.3.0')
|
data/spec/inputs/http_spec.rb
CHANGED
|
@@ -469,6 +469,137 @@ describe LogStash::Inputs::Http do
|
|
|
469
469
|
end
|
|
470
470
|
end
|
|
471
471
|
end
|
|
472
|
+
describe "response content" do
|
|
473
|
+
let(:url) { "http://127.0.0.1:#{port}" }
|
|
474
|
+
let(:response) { client.post(url, :body => "hello").call }
|
|
475
|
+
let(:response_headers) { response.headers.to_hash }
|
|
476
|
+
|
|
477
|
+
context "by default" do
|
|
478
|
+
it "responds with 'ok' as text/plain" do
|
|
479
|
+
expect(response.body).to eq("ok")
|
|
480
|
+
expect(response_headers).to include("content-type" => "text/plain", "content-length" => "2")
|
|
481
|
+
end
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
context "when response_content and a Content-Type response header are configured" do
|
|
485
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_content" => '{"errors": false}',
|
|
486
|
+
"response_headers" => { "Content-Type" => "application/json" }) }
|
|
487
|
+
it "responds with the configured body and content type" do
|
|
488
|
+
expect(response.body).to eq('{"errors": false}')
|
|
489
|
+
expect(response_headers).to include("content-type" => "application/json", "content-length" => "17")
|
|
490
|
+
end
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
context "when response_content is configured without a Content-Type response header" do
|
|
494
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_content" => "custom",
|
|
495
|
+
"response_headers" => { "x-custom" => "yes" }) }
|
|
496
|
+
it "falls back to text/plain and keeps the other headers" do
|
|
497
|
+
expect(response.body).to eq("custom")
|
|
498
|
+
expect(response_headers).to include("content-type" => "text/plain", "x-custom" => "yes")
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
context "when response_content is empty" do
|
|
503
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_content" => "") }
|
|
504
|
+
it "responds with an empty body" do
|
|
505
|
+
expect(response.code).to eq(200)
|
|
506
|
+
expect(response.body.to_s).to eq("")
|
|
507
|
+
expect(response_headers).to include("content-length" => "0")
|
|
508
|
+
end
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
context "when response_content has multi-byte characters" do
|
|
512
|
+
let(:content) { "ñandú ✓ 日本語" }
|
|
513
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_content" => content) }
|
|
514
|
+
it "encodes it as UTF-8 and sets Content-Length in bytes" do
|
|
515
|
+
expect(response.body.dup.force_encoding("UTF-8")).to eq(content)
|
|
516
|
+
expect(response_headers).to include("content-length" => content.bytesize.to_s)
|
|
517
|
+
end
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
context "when response_content is configured with response_code 204" do
|
|
521
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_code" => 204, "response_content" => "ignored") }
|
|
522
|
+
it "does not send a body" do
|
|
523
|
+
expect(response.code).to eq(204)
|
|
524
|
+
expect(response.body.to_s).to eq("")
|
|
525
|
+
end
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
context "when response_content is configured with a non-default response_code" do
|
|
529
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_code" => 202, "response_content" => "accepted") }
|
|
530
|
+
it "sends the body with that code" do
|
|
531
|
+
expect(response.code).to eq(202)
|
|
532
|
+
expect(response.body).to eq("accepted")
|
|
533
|
+
end
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
context "when called repeatedly and concurrently" do
|
|
537
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_content" => '{"errors": false}',
|
|
538
|
+
"response_headers" => { "Content-Type" => "application/json" }) }
|
|
539
|
+
it "returns the same intact body every time" do
|
|
540
|
+
bodies = 4.times.map do
|
|
541
|
+
Thread.new { 25.times.map { client.post(url, :body => "hello").call.body } }
|
|
542
|
+
end.flat_map(&:value)
|
|
543
|
+
expect(bodies.size).to eq(100)
|
|
544
|
+
expect(bodies.uniq).to eq(['{"errors": false}'])
|
|
545
|
+
end
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
context "when the request is unauthorized" do
|
|
549
|
+
subject { LogStash::Inputs::Http.new("port" => port, "user" => "test", "password" => "pwd",
|
|
550
|
+
"response_content" => "custom") }
|
|
551
|
+
it "does not use the configured content" do
|
|
552
|
+
expect(response.code).to eq(401)
|
|
553
|
+
expect(response.body.to_s).not_to include("custom")
|
|
554
|
+
end
|
|
555
|
+
end
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
describe "response_headers" do
|
|
559
|
+
let(:url) { "http://127.0.0.1:#{port}" }
|
|
560
|
+
let(:response) { client.post(url, :body => "hello").call }
|
|
561
|
+
let(:response_headers) { response.headers.to_hash }
|
|
562
|
+
|
|
563
|
+
context "with a custom Content-Type" do
|
|
564
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_headers" => { "Content-Type" => "text/csv" }) }
|
|
565
|
+
it "is not overwritten with text/plain" do
|
|
566
|
+
expect(response_headers).to include("content-type" => "text/csv")
|
|
567
|
+
expect(response.body).to eq("ok")
|
|
568
|
+
end
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
context "with a lower-case content-type" do
|
|
572
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_headers" => { "content-type" => "application/json" }) }
|
|
573
|
+
it "is not overwritten with text/plain" do
|
|
574
|
+
expect(response_headers).to include("content-type" => "application/json")
|
|
575
|
+
end
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
context "with a custom Content-Type and other headers" do
|
|
579
|
+
subject { LogStash::Inputs::Http.new("port" => port,
|
|
580
|
+
"response_headers" => { "Content-Type" => "text/html", "x-one" => "1", "x-two" => "2" }) }
|
|
581
|
+
it "keeps all of them" do
|
|
582
|
+
expect(response_headers).to include("content-type" => "text/html", "x-one" => "1", "x-two" => "2")
|
|
583
|
+
end
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
context "with a Content-Length" do
|
|
587
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_headers" => { "Content-Length" => "999" }) }
|
|
588
|
+
it "is still computed from the actual body" do
|
|
589
|
+
expect(response_headers).to include("content-length" => "2")
|
|
590
|
+
expect(response.body).to eq("ok")
|
|
591
|
+
end
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
context "with a custom Content-Type and response_code 204" do
|
|
595
|
+
subject { LogStash::Inputs::Http.new("port" => port, "response_code" => 204,
|
|
596
|
+
"response_headers" => { "Content-Type" => "application/json" }) }
|
|
597
|
+
it "sends no body" do
|
|
598
|
+
expect(response.code).to eq(204)
|
|
599
|
+
expect(response.body.to_s).to eq("")
|
|
600
|
+
end
|
|
601
|
+
end
|
|
602
|
+
end
|
|
472
603
|
end
|
|
473
604
|
|
|
474
605
|
describe "ECS support", :ecs_compatibility_support, :aggregate_failures do
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-input-http
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-11-18 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: logstash-core-plugin-api
|
|
@@ -176,7 +176,7 @@ files:
|
|
|
176
176
|
- vendor/jar-dependencies/io/netty/netty-resolver/4.1.138.Final/netty-resolver-4.1.138.Final.jar
|
|
177
177
|
- vendor/jar-dependencies/io/netty/netty-transport-native-unix-common/4.1.138.Final/netty-transport-native-unix-common-4.1.138.Final.jar
|
|
178
178
|
- vendor/jar-dependencies/io/netty/netty-transport/4.1.138.Final/netty-transport-4.1.138.Final.jar
|
|
179
|
-
- vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.
|
|
179
|
+
- vendor/jar-dependencies/org/logstash/plugins/input/http/logstash-input-http/4.3.0/logstash-input-http-4.3.0.jar
|
|
180
180
|
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
|
181
181
|
licenses:
|
|
182
182
|
- Apache License (2.0)
|
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
198
198
|
- !ruby/object:Gem::Version
|
|
199
199
|
version: '0'
|
|
200
200
|
requirements: []
|
|
201
|
-
rubygems_version: 3.
|
|
201
|
+
rubygems_version: 3.6.3
|
|
202
202
|
specification_version: 4
|
|
203
203
|
summary: Receives events over HTTP or HTTPS
|
|
204
204
|
test_files:
|