HTTP filter plugin

For other versions, see the Versioned plugin docs.

Getting Help

For questions about the plugin, open a topic in the Discuss forums. For bugs or feature requests, open an issue in Github. For the list of Elastic supported plugins, please consult the Elastic Support Matrix.

Description

The HTTP filter provides integration with external web services/REST APIs.

Compatibility with the Elastic Common Schema (ECS)

The plugin includes sensible defaults that change based on ECS compatibility mode. When targeting an ECS version, headers are set as @metadata and the target_body is a required option. See target_body , and target_headers .

HTTP Filter Configuration Options

This plugin supports the following configuration options plus the Common Options described later.

String, Array or Hash

There are also multiple configuration options related to the HTTP connectivity:

a valid filesystem path

a valid filesystem path

a valid filesystem path

a valid filesystem path

a valid filesystem path

Also see Common Options for a list of options supported by all filter plugins.

body

The body of the HTTP request to be sent.

An example to send body as json

http < body => < "key1" =>"constant_value" "key2" => "%" > body_format => "json" >

body_format

If set to "json" and the body is a type of array or hash, the body will be serialized as JSON. Otherwise it is sent as is.

ecs_compatibility

Controls this plugin’s compatibility with the Elastic Common Schema (ECS). The value of this setting affects the default value of target_body and target_headers .

headers

The HTTP headers to be sent in the request. Both the names of the headers and their values can reference values from event fields.

query

Define the query string parameters (key-value pairs) to be sent in the HTTP request.

target_body

Define the target field for placing the body of the HTTP response.

target_headers

Define the target field for placing the headers of the HTTP response.

url

The URL to send the request to. The value can be fetched from event fields.

verb

The verb to be used for the HTTP request.

HTTP Filter Connectivity Options

automatic_retries

How many times should the client retry a failing URL. We highly recommend NOT setting this value to zero if keepalive is enabled. Some servers incorrectly end keepalives early requiring a retry! Note: if retry_non_idempotent is set only GET, HEAD, PUT, DELETE, OPTIONS, and TRACE requests will be retried.

cacert

Deprecated in 1.5.0.

If you need to use a custom X.509 CA (.pem certs) specify the path to that here

client_cert

Deprecated in 1.5.0.

If you’d like to use a client certificate (note, most people don’t want this) set the path to the x509 cert here

client_key

Deprecated in 1.5.0.

If you’re using a client certificate specify the path to the encryption key here

connect_timeout

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

cookies

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

follow_redirects

Should redirects be followed? Defaults to true

keepalive

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.

keystore

Deprecated in 1.5.0.

If you need to use a custom keystore ( .jks ) specify that here. This does not work with .pem keys!

keystore_password

Deprecated in 1.5.0.

Specify the keystore password here. Note, most .jks files created with keytool require a password!

keystore_type

Deprecated in 1.5.0.

Specify the keystore type here. One of JKS or PKCS12 . Default is JKS

password

Password to be used in conjunction with the username for HTTP authentication.

pool_max

Max number of concurrent connections. Defaults to 50

pool_max_per_route

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

proxy

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: "proxy.org", port => 80, scheme => 'http', user => 'username@host', password => 'password'>
  3. Proxy host in form: 'http://proxy.org:1234', user => 'username@host', password => 'password'>

request_timeout

Timeout (in seconds) for the entire request.

retry_non_idempotent

If automatic_retries is enabled this will cause non-idempotent HTTP verbs (such as POST) to be retried.

socket_timeout

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

ssl_certificate

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

This setting can be used only if ssl_key is set.

ssl_certificate_authorities

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

ssl_cipher_suites

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

ssl_enabled

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

ssl_key

OpenSSL-style RSA private key that corresponds to the ssl_certificate .

This setting can be used only if ssl_certificate is set.

ssl_keystore_password

Set the keystore password

ssl_keystore_path

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

ssl_keystore_type

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

ssl_supported_protocols

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.

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.

ssl_truststore_password

Set the truststore password

ssl_truststore_path

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

ssl_truststore_type

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

ssl_verification_mode

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.

truststore

Deprecated in 1.5.0.

If you need to use a custom truststore ( .jks ) specify that here. This does not work with .pem certs!

truststore_password

Deprecated in 1.5.0.

Specify the truststore password here. Note, most .jks files created with keytool require a password!

truststore_type

Deprecated in 1.5.0.

Specify the truststore type here. One of JKS or PKCS12 . Default is JKS

user

Username to use with HTTP authentication for ALL requests. Note that you can also set this per-URL. If you set this you must also set the password option.

validate_after_inactivity

How long to wait before checking for a stale connection to determine if a keepalive request is needed. Consider setting this value lower than the default, possibly to 0, if you get connection errors regularly.

This client is based on Apache Commons. Here’s how the Apache Commons documentation describes this option: "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."