:plugin: http
:type: output
:default_codec: plain

///////////////////////////////////////////
START - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////
:version: %VERSION%
:release_date: %RELEASE_DATE%
:changelog_url: %CHANGELOG_URL%
:include_path: ../../../../logstash/docs/include
///////////////////////////////////////////
END - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////

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

=== Http output plugin

include::{include_path}/plugin_header.asciidoc[]

==== Description

This output lets you send events to a generic HTTP(S) endpoint.

This output will execute up to 'pool_max' requests in parallel for performance.
Consider this when tuning this plugin for performance.

Additionally, note that when parallel execution is used strict ordering of events is not
guaranteed!

Beware, this gem does not yet support codecs. Please use the 'format' option for now.

[id="plugins-{type}s-{plugin}-retry_policy"]
==== Retry policy

This output has two levels of retry: library and plugin.

[id="plugins-{type}s-{plugin}-library_retry"]
===== Library retry

The library retry applies to IO related failures. 
Non retriable errors include SSL related problems, unresolvable hosts,
connection issues, and OS/JVM level interruptions happening during a request.

The options for library retry are: 

* <<plugins-{type}s-{plugin}-automatic_retries,`automatic_retries`>>. 
Controls the number of times the plugin should retry after failures at the library level.
* <<plugins-{type}s-{plugin}-retry_non_idempotent,`retry_non_idempotent`>>. 
When set to `false`, GET, HEAD, PUT, DELETE, OPTIONS, and TRACE requests will be
retried.

[id="plugins-{type}s-{plugin}-plugin_retry"]
===== Plugin retry

The options for plugin level retry are: 

* <<plugins-{type}s-{plugin}-retry_failed,`retry_failed`>>. 
When set to `true`, the plugin retries indefinitely for HTTP error response codes defined
in the <<plugins-{type}s-{plugin}-retryable_codes,`retryable_codes`>> option
(429, 500, 502, 503, 504) and retryable exceptions (socket timeout/ error, DNS resolution failure and client protocol exception).
* <<plugins-{type}s-{plugin}-retryable_codes,`retryable_codes`>>. 
Sets http response codes that trigger a retry. 

NOTE: The `retry_failed` option does not control the library level retry.

[id="plugins-{type}s-{plugin}-options"]
==== Http Output Configuration Options

This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.

NOTE: As of version `6.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed. 
Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.

[cols="<,<,<",options="header",]
|=======================================================================
|Setting |Input type|Required
| <<plugins-{type}s-{plugin}-automatic_retries>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-connect_timeout>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-content_type>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-cookies>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-follow_redirects>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-format>> |<<string,string>>, one of `["json", "json_batch", "form", "message"]`|No
| <<plugins-{type}s-{plugin}-headers>> |<<hash,hash>>|No
| <<plugins-{type}s-{plugin}-http_compression>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-http_method>> |<<string,string>>, one of `["put", "post", "patch", "delete", "get", "head"]`|Yes
| <<plugins-{type}s-{plugin}-ignorable_codes>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-keepalive>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-mapping>> |<<hash,hash>>|No
| <<plugins-{type}s-{plugin}-message>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-pool_max>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-pool_max_per_route>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-proxy>> |<<,>>|No
| <<plugins-{type}s-{plugin}-request_timeout>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-retry_failed>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-retry_non_idempotent>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-retryable_codes>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-socket_timeout>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-ssl_certificate>> |<<path,path>>|No
| <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |list of <<path,path>>|No
| <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |list of <<string,string>>|No
| <<plugins-{type}s-{plugin}-ssl_enabled>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-ssl_keystore_password>> |<<password,password>>|No
| <<plugins-{type}s-{plugin}-ssl_keystore_path>> |<<path,path>>|No
| <<plugins-{type}s-{plugin}-ssl_keystore_type>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-ssl_supported_protocols>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-ssl_truststore_password>> |<<password,password>>|No
| <<plugins-{type}s-{plugin}-ssl_truststore_path>> |<<path,path>>|No
| <<plugins-{type}s-{plugin}-ssl_truststore_type>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-ssl_verification_mode>> |<<string,string>>, one of `["full", "none"]`|No
| <<plugins-{type}s-{plugin}-url>> |<<string,string>>|Yes
| <<plugins-{type}s-{plugin}-validate_after_inactivity>> |<<number,number>>|No
|=======================================================================

Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
output plugins.

&nbsp;

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

  * Value type is <<number,number>>
  * Default value is `1`

How many times should the client retry a failing URL. We recommend setting this option
to a value other than zero if the <<plugins-{type}s-{plugin}-keepalive,`keepalive` option>> is enabled. 
Some servers incorrectly end keepalives early, requiring a retry.
See <<plugins-{type}s-{plugin}-retry_policy,Retry Policy>> for more information.


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

  * Value type is <<number,number>>
  * Default value is `10`

Timeout (in seconds) to wait for a connection to be established. Default is `10s`

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

  * Value type is <<string,string>>
  * There is no default value for this setting.

Content type

If not specified, this defaults to the following:

* if format is "json", "application/json"
* if format is "json_batch", "application/json". Each Logstash batch of events will be concatenated into a single array and sent in one request.
* if format is "form", "application/x-www-form-urlencoded"

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

  * Value type is <<boolean,boolean>>
  * Default value is `true`

Enable cookie support. With this enabled the client will persist cookies
across requests as a normal web browser would. Enabled by default

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

  * Value type is <<boolean,boolean>>
  * Default value is `true`

Should redirects be followed? Defaults to `true`

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

  * Value can be any of: `json`, `json_batch`, `form`, `message`
  * Default value is `"json"`

Set the format of the http body.

If json_batch, each batch of events received by this output will be placed
into a single JSON array and sent in one request. This is particularly useful
for high throughput scenarios such as sending data between Logstash instaces.

If form, then the body will be the mapping (or whole event) converted
into a query parameter string, e.g. `foo=bar&baz=fizz...`

If message, then the body will be the result of formatting the event according to message

Otherwise, the event is sent as json.

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

  * Value type is <<hash,hash>>
  * There is no default value for this setting.

Custom headers to use
format is `headers => ["X-My-Header", "%{host}"]`

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

  * Value type is <<boolean,boolean>>
  * Default value is `false`

Enable request compression support. With this enabled the plugin will compress
http requests using gzip.

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

  * This is a required setting.
  * Value can be any of: `put`, `post`, `patch`, `delete`, `get`, `head`
  * There is no default value for this setting.

The HTTP Verb. One of "put", "post", "patch", "delete", "get", "head"

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

  * Value type is <<number,number>>
  * There is no default value for this setting.

If you would like to consider some non-2xx codes to be successes 
enumerate them here. Responses returning these codes will be considered successes

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

  * Value type is <<boolean,boolean>>
  * Default value is `true`

Turn this on to enable HTTP keepalive support. We highly recommend setting `automatic_retries` to at least
one with this to fix interactions with broken keepalive implementations.

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

  * Value type is <<hash,hash>>
  * There is no default value for this setting.

This lets you choose the structure and parts of the event that are sent.


For example:
[source,ruby]
   mapping => {"foo" => "%{host}"
              "bar" => "%{type}"}

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

  * Value type is <<string,string>>
  * There is no default value for this setting.



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

  * Value type is <<number,number>>
  * Default value is `50`

Max number of concurrent connections. Defaults to `50`

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

  * Value type is <<number,number>>
  * Default value is `25`

Max number of concurrent connections to a single host. Defaults to `25`

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

  * Value type is <<string,string>>
  * There is no default value for this setting.

If you'd like to use an HTTP proxy . This supports multiple configuration syntaxes:

1. Proxy host in form: `http://proxy.org:1234`
2. Proxy host in form: `{host => "proxy.org", port => 80, scheme => 'http', user => 'username@host', password => 'password'}`
3. Proxy host in form: `{url =>  'http://proxy.org:1234', user => 'username@host', password => 'password'}`

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

  * Value type is <<number,number>>
  * Default value is `60`

This module makes it easy to add a very fully configured HTTP client to logstash
based on [Manticore](https://github.com/cheald/manticore).
For an example of its usage see https://github.com/logstash-plugins/logstash-input-http_poller
Timeout (in seconds) for the entire request

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

  * Value type is <<boolean,boolean>>
  * Default value is `true`

Note that this option controls plugin-level retries only. 
It has no affect on library-level retries. 

Set this option to `false` if you want to disable infinite retries for HTTP error response codes defined in the <<plugins-{type}s-{plugin}-retryable_codes,`retryable_codes`>> or 
retryable exceptions (Timeout, SocketException, ClientProtocolException, ResolutionFailure and SocketTimeout).
See <<plugins-{type}s-{plugin}-retry_policy,Retry policy>> for more information.

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

  * Value type is <<boolean,boolean>>
  * Default value is `false`

When this option is set to `false` and `automatic_retries` is enabled, GET, HEAD, PUT, DELETE, OPTIONS, and TRACE requests will be retried.

When set to `true` and `automatic_retries` is enabled, this will cause non-idempotent HTTP verbs (such as POST) to be retried.
See <<plugins-{type}s-{plugin}-retry_policy,Retry Policy>> for more information.

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

  * Value type is <<number,number>>
  * Default value is `[429, 500, 502, 503, 504]`

If the plugin encounters these response codes, the plugin will retry indefinitely.
See <<plugins-{type}s-{plugin}-retry_policy,Retry Policy>> for more information.

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

  * Value type is <<number,number>>
  * Default value is `10`

Timeout (in seconds) to wait for data on the socket. Default is `10s`

[id="plugins-{type}s-{plugin}-ssl_certificate"]
===== `ssl_certificate`
  * Value type is <<path,path>>
  * There is no default value for this setting.

SSL certificate to use to authenticate the client. This certificate should be an OpenSSL-style X.509 certificate file.

NOTE: This setting can be used only if <<plugins-{type}s-{plugin}-ssl_key>> is set.

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

  * Value type is a list of <<path,path>>
  * There is no default value for this setting

The .cer or .pem CA files to validate the server's certificate.

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

  * Value type is a list of <<string,string>>
  * There is no default value for this setting

The list of cipher suites to use, listed by priorities.
Supported cipher suites vary depending on the Java and protocol versions.

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

  * Value type is <<boolean,boolean>>
  * Default value is `true`

Enable SSL/TLS secured communication. It must be `true` for other `ssl_` options
to take effect.

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

  * Value type is <<path,path>>
  * There is no default value for this setting.

OpenSSL-style RSA private key that corresponds to the <<plugins-{type}s-{plugin}-ssl_certificate>>.

NOTE: This setting can be used only if <<plugins-{type}s-{plugin}-ssl_certificate>> is set.

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

  * Value type is <<password,password>>
  * There is no default value for this setting.

Set the keystore password

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

  * Value type is <<path,path>>
  * There is no default value for this setting.

The keystore used to present a certificate to the server.
It can be either `.jks` or `.p12`

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

  * Value can be any of: `jks`, `pkcs12`
  * If not provided, the value will be inferred from the keystore filename.

The format of the keystore file. It must be either `jks` or `pkcs12`.

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

  * Value type is <<string,string>>
  * Allowed values are: `'TLSv1.1'`, `'TLSv1.2'`, `'TLSv1.3'`
  * Default depends on the JDK being used. With up-to-date Logstash, the default is `['TLSv1.2', 'TLSv1.3']`.
    `'TLSv1.1'` is not considered secure and is only provided for legacy applications.

List of allowed SSL/TLS versions to use when establishing a connection to the HTTP endpoint.

For Java 8 `'TLSv1.3'` is supported  only since **8u262** (AdoptOpenJDK), but requires that you set the
`LS_JAVA_OPTS="-Djdk.tls.client.protocols=TLSv1.3"` system property in Logstash.

NOTE: If you configure the plugin to use `'TLSv1.1'` on any recent JVM, such as the one packaged with Logstash,
the protocol is disabled by default and needs to be enabled manually by changing `jdk.tls.disabledAlgorithms` in
the *$JDK_HOME/conf/security/java.security* configuration file. That is, `TLSv1.1` needs to be removed from the list.

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

  * Value type is <<password,password>>
  * There is no default value for this setting.

Set the truststore password

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

  * Value type is <<path,path>>
  * There is no default value for this setting.

The truststore to validate the server's certificate.
It can be either `.jks` or `.p12`.

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

  * Value can be any of: `jks`, `pkcs12`
  * If not provided, the value will be inferred from the truststore filename.

The format of the truststore file. It must be either `jks` or `pkcs12`.

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

  * Value type is <<string,string>>
  * Supported values are: `full`, `none`
  * Default value is `full`

Controls the verification of server certificates.
The `full` option verifies that the provided certificate is signed by a trusted authority (CA)
and also that the server’s hostname (or IP address) matches the names identified within the certificate.

The `none` setting performs no verification of the server’s certificate.
This mode disables many of the security benefits of SSL/TLS and should only be used after cautious consideration.
It is primarily intended as a temporary diagnostic mechanism when attempting to resolve TLS errors.
Using `none`  in production environments is strongly discouraged.

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

  * This is a required setting.
  * Value type is <<string,string>>
  * There is no default value for this setting.

URL to use

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

  * Value type is <<number,number>>
  * Default value is `200`

How long to wait before checking if the connection is stale before executing a request on a connection using keepalive.
You may want to set this lower, possibly to 0 if you get connection errors regularly
Quoting the Apache commons docs (this client is based Apache Commmons):
'Defines period of inactivity in milliseconds after which persistent connections must be re-validated prior to being leased to the consumer. Non-positive value passed to this method disables connection validation. This check helps detect connections that have become stale (half-closed) while kept inactive in the pool.'
See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info]


[id="plugins-{type}s-{plugin}-obsolete-options"]
==== HTTP Output Obsolete Configuration Options

WARNING: As of version `6.0.0` of this plugin, some configuration options have been replaced.
The plugin will fail to start if it contains any of these obsolete options. 


[cols="<,<",options="header",]
|=======================================================================
|Setting|Replaced by
| cacert |<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
| client_cert |<<plugins-{type}s-{plugin}-ssl_certificate>>
| client_key |<<plugins-{type}s-{plugin}-ssl_key>>
| keystore |<<plugins-{type}s-{plugin}-ssl_keystore_path>>
| keystore_password |<<plugins-{type}s-{plugin}-ssl_keystore_password>>
| keystore_type |<<plugins-{type}s-{plugin}-ssl_keystore_password>>
| truststore |<<plugins-{type}s-{plugin}-ssl_truststore_path>>
| truststore_password |<<plugins-{type}s-{plugin}-ssl_truststore_password>>
| truststore_type |<<plugins-{type}s-{plugin}-ssl_truststore_type>>
|=======================================================================


[id="plugins-{type}s-{plugin}-common-options"]
include::{include_path}/{type}.asciidoc[]

:default_codec!: