Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds response_body to configuration options #163

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updates docs with response_body
excalq committed Jan 24, 2023

Unverified

This user has not yet uploaded their public signing key.
commit b5cd6b3fc609b75912a7d9c772afa0523499c554
16 changes: 14 additions & 2 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ Using this input you can receive single or multiline events over http(s).
Applications can send an HTTP request to the endpoint started by this input and
Logstash will convert it into an event for subsequent processing. Users
can pass plain text, JSON, or any formatted data and use a corresponding codec with this
input. For Content-Type `application/json` the `json` codec is used, but for all other
input. For content-type `application/json` the `json` codec is used, but for all other
data formats, `plain` codec is used.

This input can also be used to receive webhook requests to integrate with other services
@@ -101,6 +101,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
| <<plugins-{type}s-{plugin}-max_pending_requests>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-response_headers>> |<<hash,hash>>|No
| <<plugins-{type}s-{plugin}-response_code>> |<<number,number>>, one of `[200, 201, 202, 204]`|No
| <<plugins-{type}s-{plugin}-response_body>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-ssl_certificate>> |a valid filesystem path|No
| <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |<<array,array>>|No
@@ -280,11 +281,22 @@ invalid credentials (401), internal errors (503) or backpressure (429).

If 204 (No Content) is set, the response body will not be sent in the response.

[id="plugins-{type}s-{plugin}-response_body"]
===== `response_body`

* Value type is <<string,string>>
* Default value is `ok`

The text body of the response returned to clients on successful POSTs.
The default `ok` can be overriden with any string content such as JSON.

If 204 (No Content) is set, the `response_body` option is ignored.

[id="plugins-{type}s-{plugin}-response_headers"]
===== `response_headers`

* Value type is <<hash,hash>>
* Default value is `{"Content-Type"=>"text/plain"}`
* Default value is `{"content-type"=>"text/plain"}`

specify a custom set of response headers

2 changes: 1 addition & 1 deletion lib/logstash/inputs/http.rb
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ class LogStash::Inputs::Http < LogStash::Inputs::Base
# Send reponses with this HTTP code. 204 is `no content`, and forces an empty response body
config :response_code, :validate => [200, 201, 202, 204], :default => 200

# Send this as the body to each HTTP POST. A JSON example: `"{\"ok\": true}"`.
# Send this as the body to each HTTP POST. A JSON example: `'{"ok": true}'`.
config :response_body, :default => "ok"

# specify a custom set of response headers (use lowercase keys, per netty.io)