logstash-output-elasticsearch 10.8.6-java → 11.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/docs/index.asciidoc +132 -22
  4. data/lib/logstash/outputs/elasticsearch.rb +125 -64
  5. data/lib/logstash/outputs/elasticsearch/data_stream_support.rb +233 -0
  6. data/lib/logstash/outputs/elasticsearch/http_client.rb +9 -7
  7. data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +49 -62
  8. data/lib/logstash/outputs/elasticsearch/ilm.rb +13 -45
  9. data/lib/logstash/outputs/elasticsearch/license_checker.rb +26 -23
  10. data/lib/logstash/outputs/elasticsearch/template_manager.rb +4 -6
  11. data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-8x.json +1 -0
  12. data/lib/logstash/plugin_mixins/elasticsearch/api_configs.rb +157 -153
  13. data/lib/logstash/plugin_mixins/elasticsearch/common.rb +71 -58
  14. data/logstash-output-elasticsearch.gemspec +3 -3
  15. data/spec/es_spec_helper.rb +7 -12
  16. data/spec/fixtures/_nodes/{5x_6x.json → 6x.json} +5 -5
  17. data/spec/integration/outputs/compressed_indexing_spec.rb +47 -46
  18. data/spec/integration/outputs/data_stream_spec.rb +61 -0
  19. data/spec/integration/outputs/delete_spec.rb +49 -51
  20. data/spec/integration/outputs/ilm_spec.rb +236 -248
  21. data/spec/integration/outputs/index_spec.rb +5 -2
  22. data/spec/integration/outputs/index_version_spec.rb +78 -82
  23. data/spec/integration/outputs/ingest_pipeline_spec.rb +58 -58
  24. data/spec/integration/outputs/painless_update_spec.rb +74 -164
  25. data/spec/integration/outputs/parent_spec.rb +67 -75
  26. data/spec/integration/outputs/retry_spec.rb +6 -6
  27. data/spec/integration/outputs/sniffer_spec.rb +15 -54
  28. data/spec/integration/outputs/templates_spec.rb +79 -81
  29. data/spec/integration/outputs/update_spec.rb +99 -101
  30. data/spec/spec_helper.rb +10 -0
  31. data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +528 -0
  32. data/spec/unit/outputs/elasticsearch/http_client/manticore_adapter_spec.rb +1 -0
  33. data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +36 -29
  34. data/spec/unit/outputs/elasticsearch/http_client_spec.rb +2 -3
  35. data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +10 -12
  36. data/spec/unit/outputs/elasticsearch_proxy_spec.rb +1 -2
  37. data/spec/unit/outputs/elasticsearch_spec.rb +176 -41
  38. data/spec/unit/outputs/elasticsearch_ssl_spec.rb +1 -2
  39. data/spec/unit/outputs/error_whitelist_spec.rb +3 -2
  40. data/spec/unit/outputs/license_check_spec.rb +0 -16
  41. metadata +29 -36
  42. data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-2x.json +0 -95
  43. data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-5x.json +0 -46
  44. data/spec/fixtures/_nodes/2x_1x.json +0 -27
  45. data/spec/fixtures/scripts/groovy/scripted_update.groovy +0 -2
  46. data/spec/fixtures/scripts/groovy/scripted_update_nested.groovy +0 -2
  47. data/spec/fixtures/scripts/groovy/scripted_upsert.groovy +0 -2
  48. data/spec/integration/outputs/groovy_update_spec.rb +0 -150
  49. data/spec/integration/outputs/templates_5x_spec.rb +0 -98
@@ -4,41 +4,24 @@ module LogStash; module Outputs; class ElasticSearch
4
4
  ILM_POLICY_PATH = "default-ilm-policy.json"
5
5
 
6
6
  def setup_ilm
7
- return unless ilm_in_use?
8
7
  logger.warn("Overwriting supplied index #{@index} with rollover alias #{@ilm_rollover_alias}") unless default_index?(@index)
9
8
  @index = @ilm_rollover_alias
10
9
  maybe_create_rollover_alias
11
10
  maybe_create_ilm_policy
12
11
  end
13
12
 
14
- def default_rollover_alias?(rollover_alias)
15
- rollover_alias == default_ilm_rollover_alias
16
- end
17
-
18
- def ilm_alias_set?
19
- default_index?(@index) || !default_rollover_alias?(@ilm_rollover_alias)
20
- end
21
-
22
13
  def ilm_in_use?
23
14
  return @ilm_actually_enabled if defined?(@ilm_actually_enabled)
24
15
  @ilm_actually_enabled =
25
16
  begin
26
17
  if @ilm_enabled == 'auto'
27
18
  if ilm_on_by_default?
28
- ilm_ready, error = ilm_ready?
29
- if !ilm_ready
30
- @logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - #{error}")
31
- false
32
- else
33
- ilm_alias_set?
34
- end
19
+ ilm_alias_set?
35
20
  else
36
21
  @logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - Your Elasticsearch cluster is before 7.0.0, which is the minimum version required to automatically run Index Lifecycle Management")
37
22
  false
38
23
  end
39
24
  elsif @ilm_enabled.to_s == 'true'
40
- ilm_ready, error = ilm_ready?
41
- raise LogStash::ConfigurationError,"Index Lifecycle Management is set to enabled in Logstash, but cannot be used - #{error}" unless ilm_ready
42
25
  ilm_alias_set?
43
26
  else
44
27
  false
@@ -46,46 +29,31 @@ module LogStash; module Outputs; class ElasticSearch
46
29
  end
47
30
  end
48
31
 
49
- def ilm_on_by_default?
50
- maximum_seen_major_version >= 7
51
- end
32
+ private
52
33
 
53
- def ilm_ready?
54
- # Check the Elasticsearch instance for ILM readiness - this means that the version has to be a non-OSS release, with ILM feature
55
- # available and enabled.
56
- begin
57
- xpack = client.get_xpack_info
58
- features = xpack.nil? || xpack.empty? ? nil : xpack["features"]
59
- ilm = features.nil? ? nil : features["ilm"]
60
- return false, "Index Lifecycle management is not installed on your Elasticsearch cluster" if features.nil? || ilm.nil?
61
- return false, "Index Lifecycle management is not available in your Elasticsearch cluster" unless ilm['available']
62
- return false, "Index Lifecycle management is not enabled in your Elasticsearch cluster" unless ilm['enabled']
63
- return true, nil
64
- rescue ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError => e
65
- # Check xpack endpoint: If no xpack endpoint, then this version of Elasticsearch is not compatible
66
- if e.response_code == 404
67
- return false, "Index Lifecycle management is not installed on your Elasticsearch cluster"
68
- elsif e.response_code == 400
69
- return false, "Index Lifecycle management is not installed on your Elasticsearch cluster"
70
- else
71
- raise e
72
- end
73
- end
34
+ def ilm_alias_set?
35
+ default_index?(@index) || !default_rollover_alias?(@ilm_rollover_alias)
74
36
  end
75
37
 
76
- private
38
+ def ilm_on_by_default?
39
+ maximum_seen_major_version >= 7
40
+ end
77
41
 
78
42
  def default_index?(index)
79
43
  index == @default_index
80
44
  end
81
45
 
46
+ def default_rollover_alias?(rollover_alias)
47
+ rollover_alias == default_ilm_rollover_alias
48
+ end
49
+
82
50
  def ilm_policy_default?
83
51
  ilm_policy == LogStash::Outputs::ElasticSearch::DEFAULT_POLICY
84
52
  end
85
53
 
86
54
  def maybe_create_ilm_policy
87
55
  if ilm_policy_default?
88
- client.ilm_policy_put(ilm_policy, policy_payload) unless client.ilm_policy_exists?(ilm_policy)
56
+ client.ilm_policy_put(ilm_policy, policy_payload) unless client.ilm_policy_exists?(ilm_policy)
89
57
  else
90
58
  raise LogStash::ConfigurationError, "The specified ILM policy #{ilm_policy} does not exist on your Elasticsearch instance" unless client.ilm_policy_exists?(ilm_policy)
91
59
  end
@@ -114,4 +82,4 @@ module LogStash; module Outputs; class ElasticSearch
114
82
  LogStash::Json.load(::IO.read(policy_path))
115
83
  end
116
84
  end
117
- end; end; end
85
+ end; end; end
@@ -7,41 +7,44 @@ module LogStash; module Outputs; class ElasticSearch
7
7
 
8
8
  # Figure out if the provided license is appropriate or not
9
9
  # The appropriate_license? methods is the method called from LogStash::Outputs::ElasticSearch::HttpClient::Pool#healthcheck!
10
+ # @param pool
10
11
  # @param url [LogStash::Util::SafeURI] ES node URL
11
- # @param license [Hash] ES node deserialized licence document
12
12
  # @return [Boolean] true if provided license is deemed appropriate
13
13
  def appropriate_license?(pool, url)
14
- return true if oss?
15
-
16
- license = pool.get_license(url)
17
- if valid_es_license?(license)
14
+ license = extract_license(pool.get_license(url))
15
+ case license_status(license)
16
+ when 'active'
18
17
  true
19
- else
20
- # As this version is to be shipped with Logstash 7.x we won't mark the connection as unlicensed
21
- #
22
- # @logger.error("Cannot connect to the Elasticsearch cluster configured in the Elasticsearch output. Logstash requires the default distribution of Elasticsearch. Please update to the default distribution of Elasticsearch for full access to all free features, or switch to the OSS distribution of Logstash.", :url => url.sanitized.to_s)
23
- # meta[:state] = :unlicensed
24
- #
25
- # Instead we'll log a deprecation warning and mark it as alive:
26
- #
27
- log_license_deprecation_warn(url)
18
+ when nil
19
+ warn_no_license(url)
20
+ false
21
+ else # 'invalid', 'expired'
22
+ warn_invalid_license(url, license)
28
23
  true
29
24
  end
30
25
  end
31
26
 
32
- # Note that oss? could be private but is used by the Pool specs
33
- def oss?
34
- LogStash::OSS
27
+ NO_LICENSE = {}.freeze
28
+ private_constant :NO_LICENSE
29
+
30
+ def extract_license(license)
31
+ license.fetch("license", NO_LICENSE)
32
+ end
33
+
34
+ def license_status(license)
35
+ license.fetch("status", nil)
35
36
  end
36
37
 
37
- # Note that valid_es_license? could be private but is used by the Pool specs
38
- def valid_es_license?(license)
39
- license.fetch("license", {}).fetch("status", nil) == "active"
38
+ private
39
+
40
+ def warn_no_license(url)
41
+ @logger.error("Could not connect to a compatible version of Elasticsearch", url: url.sanitized.to_s)
40
42
  end
41
43
 
42
- # Note that log_license_deprecation_warn could be private but is used by the Pool specs
43
- def log_license_deprecation_warn(url)
44
- @logger.warn("DEPRECATION WARNING: Connecting to an OSS distribution of Elasticsearch using the default distribution of Logstash will stop working in Logstash 8.0.0. Please upgrade to the default distribution of Elasticsearch, or use the OSS distribution of Logstash", :url => url.sanitized.to_s)
44
+ def warn_invalid_license(url, license)
45
+ @logger.warn("Elasticsearch license is not active, please check Elasticsearch’s licensing information",
46
+ url: url.sanitized.to_s, license: license)
45
47
  end
48
+
46
49
  end
47
50
  end; end; end
@@ -13,10 +13,8 @@ module LogStash; module Outputs; class ElasticSearch
13
13
  end
14
14
 
15
15
  add_ilm_settings_to_template(plugin, template) if plugin.ilm_in_use?
16
- plugin.logger.info("Attempting to install template", :manage_template => template)
16
+ plugin.logger.debug("Attempting to install template", template: template)
17
17
  install(plugin.client, template_name(plugin), template, plugin.template_overwrite)
18
- rescue => e
19
- plugin.logger.error("Failed to install template.", :message => e.message, :class => e.class.name, :backtrace => e.backtrace)
20
18
  end
21
19
 
22
20
  private
@@ -38,7 +36,7 @@ module LogStash; module Outputs; class ElasticSearch
38
36
  template['index_patterns'] = "#{plugin.ilm_rollover_alias}-*"
39
37
  settings = template_settings(plugin, template)
40
38
  if settings && (settings['index.lifecycle.name'] || settings['index.lifecycle.rollover_alias'])
41
- plugin.logger.info("Overwriting index lifecycle name and rollover alias as ILM is enabled.")
39
+ plugin.logger.info("Overwriting index lifecycle name and rollover alias as ILM is enabled")
42
40
  end
43
41
  settings.update({ 'index.lifecycle.name' => plugin.ilm_policy, 'index.lifecycle.rollover_alias' => plugin.ilm_rollover_alias})
44
42
  end
@@ -55,13 +53,13 @@ module LogStash; module Outputs; class ElasticSearch
55
53
  end
56
54
 
57
55
  def self.default_template_path(es_major_version, ecs_compatibility=:disabled)
58
- template_version = es_major_version == 1 ? 2 : es_major_version
56
+ template_version = es_major_version
59
57
  default_template_name = "templates/ecs-#{ecs_compatibility}/elasticsearch-#{template_version}x.json"
60
58
  ::File.expand_path(default_template_name, ::File.dirname(__FILE__))
61
59
  end
62
60
 
63
61
  def self.read_template_file(template_path)
64
- raise ArgumentError, "Template file '#{template_path}' could not be found!" unless ::File.exists?(template_path)
62
+ raise ArgumentError, "Template file '#{template_path}' could not be found" unless ::File.exists?(template_path)
65
63
  template_data = ::IO.read(template_path)
66
64
  LogStash::Json.load(template_data)
67
65
  end
@@ -0,0 +1 @@
1
+ lib/logstash/outputs/elasticsearch/templates/ecs-v1/Users/yaauie/src/elastic/logstash-plugins/logsta
@@ -5,159 +5,163 @@ module LogStash; module PluginMixins; module ElasticSearch
5
5
 
6
6
  DEFAULT_HOST = ::LogStash::Util::SafeURI.new("//127.0.0.1")
7
7
 
8
- def self.included(mod)
9
- # Username to authenticate to a secure Elasticsearch cluster
10
- mod.config :user, :validate => :string
11
- # Password to authenticate to a secure Elasticsearch cluster
12
- mod.config :password, :validate => :password
13
-
14
- # Authenticate using Elasticsearch API key.
15
- # format is id:api_key (as returned by https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html[Create API key])
16
- mod.config :api_key, :validate => :password
17
-
18
- # Cloud authentication string ("<username>:<password>" format) is an alternative for the `user`/`password` configuration.
19
- #
20
- # For more details, check out the https://www.elastic.co/guide/en/logstash/current/connecting-to-cloud.html#_cloud_auth[cloud documentation]
21
- mod.config :cloud_auth, :validate => :password
22
-
23
- # The document ID for the index. Useful for overwriting existing entries in
24
- # Elasticsearch with the same ID.
25
- mod.config :document_id, :validate => :string
26
-
27
- # HTTP Path at which the Elasticsearch server lives. Use this if you must run Elasticsearch behind a proxy that remaps
28
- # the root path for the Elasticsearch HTTP API lives.
29
- # Note that if you use paths as components of URLs in the 'hosts' field you may
30
- # not also set this field. That will raise an error at startup
31
- mod.config :path, :validate => :string
32
-
33
- # HTTP Path to perform the _bulk requests to
34
- # this defaults to a concatenation of the path parameter and "_bulk"
35
- mod.config :bulk_path, :validate => :string
36
-
37
- # Pass a set of key value pairs as the URL query string. This query string is added
38
- # to every host listed in the 'hosts' configuration. If the 'hosts' list contains
39
- # urls that already have query strings, the one specified here will be appended.
40
- mod.config :parameters, :validate => :hash
41
-
42
- # Enable SSL/TLS secured communication to Elasticsearch cluster. Leaving this unspecified will use whatever scheme
43
- # is specified in the URLs listed in 'hosts'. If no explicit protocol is specified plain HTTP will be used.
44
- # If SSL is explicitly disabled here the plugin will refuse to start if an HTTPS URL is given in 'hosts'
45
- mod.config :ssl, :validate => :boolean
46
-
47
- # Option to validate the server's certificate. Disabling this severely compromises security.
48
- # For more information on disabling certificate verification please read
49
- # https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf
50
- mod.config :ssl_certificate_verification, :validate => :boolean, :default => true
51
-
52
- # The .cer or .pem file to validate the server's certificate
53
- mod.config :cacert, :validate => :path
54
-
55
- # The JKS truststore to validate the server's certificate.
56
- # Use either `:truststore` or `:cacert`
57
- mod.config :truststore, :validate => :path
58
-
59
- # Set the truststore password
60
- mod.config :truststore_password, :validate => :password
61
-
62
- # The keystore used to present a certificate to the server.
63
- # It can be either .jks or .p12
64
- mod.config :keystore, :validate => :path
65
-
66
- # Set the keystore password
67
- mod.config :keystore_password, :validate => :password
68
-
69
- # This setting asks Elasticsearch for the list of all cluster nodes and adds them to the hosts list.
70
- # Note: This will return ALL nodes with HTTP enabled (including master nodes!). If you use
71
- # this with master nodes, you probably want to disable HTTP on them by setting
72
- # `http.enabled` to false in their elasticsearch.yml. You can either use the `sniffing` option or
73
- # manually enter multiple Elasticsearch hosts using the `hosts` parameter.
74
- mod.config :sniffing, :validate => :boolean, :default => false
75
-
76
- # How long to wait, in seconds, between sniffing attempts
77
- mod.config :sniffing_delay, :validate => :number, :default => 5
78
-
79
- # HTTP Path to be used for the sniffing requests
80
- # the default value is computed by concatenating the path value and "_nodes/http"
81
- # if sniffing_path is set it will be used as an absolute path
82
- # do not use full URL here, only paths, e.g. "/sniff/_nodes/http"
83
- mod.config :sniffing_path, :validate => :string
84
-
85
- # Set the address of a forward HTTP proxy.
86
- # This used to accept hashes as arguments but now only accepts
87
- # arguments of the URI type to prevent leaking credentials.
88
- mod.config :proxy, :validate => :uri # but empty string is allowed
89
-
90
- # Set the timeout, in seconds, for network operations and requests sent Elasticsearch. If
91
- # a timeout occurs, the request will be retried.
92
- mod.config :timeout, :validate => :number, :default => 60
93
-
94
- # Set the Elasticsearch errors in the whitelist that you don't want to log.
95
- # A useful example is when you want to skip all 409 errors
96
- # which are `document_already_exists_exception`.
97
- mod.config :failure_type_logging_whitelist, :validate => :array, :default => []
98
-
99
- # While the output tries to reuse connections efficiently we have a maximum.
100
- # This sets the maximum number of open connections the output will create.
101
- # Setting this too low may mean frequently closing / opening connections
102
- # which is bad.
103
- mod.config :pool_max, :validate => :number, :default => 1000
104
-
105
- # While the output tries to reuse connections efficiently we have a maximum per endpoint.
106
- # This sets the maximum number of open connections per endpoint the output will create.
107
- # Setting this too low may mean frequently closing / opening connections
108
- # which is bad.
109
- mod.config :pool_max_per_route, :validate => :number, :default => 100
110
-
111
- # HTTP Path where a HEAD request is sent when a backend is marked down
112
- # the request is sent in the background to see if it has come back again
113
- # before it is once again eligible to service requests.
114
- # If you have custom firewall rules you may need to change this
115
- mod.config :healthcheck_path, :validate => :string
116
-
117
- # How frequently, in seconds, to wait between resurrection attempts.
118
- # Resurrection is the process by which backend endpoints marked 'down' are checked
119
- # to see if they have come back to life
120
- mod.config :resurrect_delay, :validate => :number, :default => 5
121
-
122
- # How long to wait before checking if the connection is stale before executing a request on a connection using keepalive.
123
- # You may want to set this lower, if you get connection errors regularly
124
- # Quoting the Apache commons docs (this client is based Apache Commmons):
125
- # 'Defines period of inactivity in milliseconds after which persistent connections must
126
- # be re-validated prior to being leased to the consumer. Non-positive value passed to
127
- # this method disables connection validation. This check helps detect connections that
128
- # have become stale (half-closed) while kept inactive in the pool.'
129
- # See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info]
130
- mod.config :validate_after_inactivity, :validate => :number, :default => 10000
131
-
132
- # Enable gzip compression on requests. Note that response compression is on by default for Elasticsearch v5.0 and beyond
133
- mod.config :http_compression, :validate => :boolean, :default => false
134
-
135
- # Custom Headers to send on each request to elasticsearch nodes
136
- mod.config :custom_headers, :validate => :hash, :default => {}
137
-
138
- # Sets the host(s) of the remote instance. If given an array it will load balance requests across the hosts specified in the `hosts` parameter.
139
- # Remember the `http` protocol uses the http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#modules-http[http] address (eg. 9200, not 9300).
140
- # `"127.0.0.1"`
141
- # `["127.0.0.1:9200","127.0.0.2:9200"]`
142
- # `["http://127.0.0.1"]`
143
- # `["https://127.0.0.1:9200"]`
144
- # `["https://127.0.0.1:9200/mypath"]` (If using a proxy on a subpath)
145
- # It is important to exclude http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html[dedicated master nodes] from the `hosts` list
146
- # to prevent LS from sending bulk requests to the master nodes. So this parameter should only reference either data or client nodes in Elasticsearch.
147
- #
148
- # Any special characters present in the URLs here MUST be URL escaped! This means `#` should be put in as `%23` for instance.
149
- mod.config :hosts, :validate => :uri, :default => [ DEFAULT_HOST ], :list => true
150
-
151
- # Cloud ID, from the Elastic Cloud web console. If set `hosts` should not be used.
152
- #
153
- # For more details, check out the https://www.elastic.co/guide/en/logstash/current/connecting-to-cloud.html#_cloud_id[cloud documentation]
154
- mod.config :cloud_id, :validate => :string
155
-
156
- # Set initial interval in seconds between bulk retries. Doubled on each retry up to `retry_max_interval`
157
- mod.config :retry_initial_interval, :validate => :number, :default => 2
158
-
159
- # Set max interval in seconds between bulk retries.
160
- mod.config :retry_max_interval, :validate => :number, :default => 64
8
+ CONFIG_PARAMS = {
9
+ # Username to authenticate to a secure Elasticsearch cluster
10
+ :user => { :validate => :string },
11
+ # Password to authenticate to a secure Elasticsearch cluster
12
+ :password => { :validate => :password },
13
+
14
+ # Authenticate using Elasticsearch API key.
15
+ # format is id:api_key (as returned by https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html[Create API key])
16
+ :api_key => { :validate => :password },
17
+
18
+ # Cloud authentication string ("<username>:<password>" format) is an alternative for the `user`/`password` configuration.
19
+ #
20
+ # For more details, check out the https://www.elastic.co/guide/en/logstash/current/connecting-to-cloud.html#_cloud_auth[cloud documentation]
21
+ :cloud_auth => { :validate => :password },
22
+
23
+ # The document ID for the index. Useful for overwriting existing entries in
24
+ # Elasticsearch with the same ID.
25
+ :document_id => { :validate => :string },
26
+
27
+ # HTTP Path at which the Elasticsearch server lives. Use this if you must run Elasticsearch behind a proxy that remaps
28
+ # the root path for the Elasticsearch HTTP API lives.
29
+ # Note that if you use paths as components of URLs in the 'hosts' field you may
30
+ # not also set this field. That will raise an error at startup
31
+ :path => { :validate => :string },
32
+
33
+ # HTTP Path to perform the _bulk requests to
34
+ # this defaults to a concatenation of the path parameter and "_bulk"
35
+ :bulk_path => { :validate => :string },
36
+
37
+ # Pass a set of key value pairs as the URL query string. This query string is added
38
+ # to every host listed in the 'hosts' configuration. If the 'hosts' list contains
39
+ # urls that already have query strings, the one specified here will be appended.
40
+ :parameters => { :validate => :hash },
41
+
42
+ # Enable SSL/TLS secured communication to Elasticsearch cluster. Leaving this unspecified will use whatever scheme
43
+ # is specified in the URLs listed in 'hosts'. If no explicit protocol is specified plain HTTP will be used.
44
+ # If SSL is explicitly disabled here the plugin will refuse to start if an HTTPS URL is given in 'hosts'
45
+ :ssl => { :validate => :boolean },
46
+
47
+ # Option to validate the server's certificate. Disabling this severely compromises security.
48
+ # For more information on disabling certificate verification please read
49
+ # https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf
50
+ :ssl_certificate_verification => { :validate => :boolean, :default => true },
51
+
52
+ # The .cer or .pem file to validate the server's certificate
53
+ :cacert => { :validate => :path },
54
+
55
+ # The JKS truststore to validate the server's certificate.
56
+ # Use either `:truststore` or `:cacert`
57
+ :truststore => { :validate => :path },
58
+
59
+ # Set the truststore password
60
+ :truststore_password => { :validate => :password },
61
+
62
+ # The keystore used to present a certificate to the server.
63
+ # It can be either .jks or .p12
64
+ :keystore => { :validate => :path },
65
+
66
+ # Set the keystore password
67
+ :keystore_password => { :validate => :password },
68
+
69
+ # This setting asks Elasticsearch for the list of all cluster nodes and adds them to the hosts list.
70
+ # Note: This will return ALL nodes with HTTP enabled (including master nodes!). If you use
71
+ # this with master nodes, you probably want to disable HTTP on them by setting
72
+ # `http.enabled` to false in their elasticsearch.yml. You can either use the `sniffing` option or
73
+ # manually enter multiple Elasticsearch hosts using the `hosts` parameter.
74
+ :sniffing => { :validate => :boolean, :default => false },
75
+
76
+ # How long to wait, in seconds, between sniffing attempts
77
+ :sniffing_delay => { :validate => :number, :default => 5 },
78
+
79
+ # HTTP Path to be used for the sniffing requests
80
+ # the default value is computed by concatenating the path value and "_nodes/http"
81
+ # if sniffing_path is set it will be used as an absolute path
82
+ # do not use full URL here, only paths, e.g. "/sniff/_nodes/http"
83
+ :sniffing_path => { :validate => :string },
84
+
85
+ # Set the address of a forward HTTP proxy.
86
+ # This used to accept hashes as arguments but now only accepts
87
+ # arguments of the URI type to prevent leaking credentials.
88
+ :proxy => { :validate => :uri }, # but empty string is allowed
89
+
90
+ # Set the timeout, in seconds, for network operations and requests sent Elasticsearch. If
91
+ # a timeout occurs, the request will be retried.
92
+ :timeout => { :validate => :number, :default => 60 },
93
+
94
+ # Set the Elasticsearch errors in the whitelist that you don't want to log.
95
+ # A useful example is when you want to skip all 409 errors
96
+ # which are `document_already_exists_exception`.
97
+ :failure_type_logging_whitelist => { :validate => :array, :default => [] },
98
+
99
+ # While the output tries to reuse connections efficiently we have a maximum.
100
+ # This sets the maximum number of open connections the output will create.
101
+ # Setting this too low may mean frequently closing / opening connections
102
+ # which is bad.
103
+ :pool_max => { :validate => :number, :default => 1000 },
104
+
105
+ # While the output tries to reuse connections efficiently we have a maximum per endpoint.
106
+ # This sets the maximum number of open connections per endpoint the output will create.
107
+ # Setting this too low may mean frequently closing / opening connections
108
+ # which is bad.
109
+ :pool_max_per_route => { :validate => :number, :default => 100 },
110
+
111
+ # HTTP Path where a HEAD request is sent when a backend is marked down
112
+ # the request is sent in the background to see if it has come back again
113
+ # before it is once again eligible to service requests.
114
+ # If you have custom firewall rules you may need to change this
115
+ :healthcheck_path => { :validate => :string },
116
+
117
+ # How frequently, in seconds, to wait between resurrection attempts.
118
+ # Resurrection is the process by which backend endpoints marked 'down' are checked
119
+ # to see if they have come back to life
120
+ :resurrect_delay => { :validate => :number, :default => 5 },
121
+
122
+ # How long to wait before checking if the connection is stale before executing a request on a connection using keepalive.
123
+ # You may want to set this lower, if you get connection errors regularly
124
+ # Quoting the Apache commons docs (this client is based Apache Commmons):
125
+ # 'Defines period of inactivity in milliseconds after which persistent connections must
126
+ # be re-validated prior to being leased to the consumer. Non-positive value passed to
127
+ # this method disables connection validation. This check helps detect connections that
128
+ # have become stale (half-closed) while kept inactive in the pool.'
129
+ # See https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html#setValidateAfterInactivity(int)[these docs for more info]
130
+ :validate_after_inactivity => { :validate => :number, :default => 10000 },
131
+
132
+ # Enable gzip compression on requests. Note that response compression is on by default for Elasticsearch v5.0 and beyond
133
+ :http_compression => { :validate => :boolean, :default => false },
134
+
135
+ # Custom Headers to send on each request to elasticsearch nodes
136
+ :custom_headers => { :validate => :hash, :default => {} },
137
+
138
+ # Sets the host(s) of the remote instance. If given an array it will load balance requests across the hosts specified in the `hosts` parameter.
139
+ # Remember the `http` protocol uses the http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html#modules-http[http] address (eg. 9200, not 9300).
140
+ # `"127.0.0.1"`
141
+ # `["127.0.0.1:9200","127.0.0.2:9200"]`
142
+ # `["http://127.0.0.1"]`
143
+ # `["https://127.0.0.1:9200"]`
144
+ # `["https://127.0.0.1:9200/mypath"]` (If using a proxy on a subpath)
145
+ # It is important to exclude http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html[dedicated master nodes] from the `hosts` list
146
+ # to prevent LS from sending bulk requests to the master nodes. So this parameter should only reference either data or client nodes in Elasticsearch.
147
+ #
148
+ # Any special characters present in the URLs here MUST be URL escaped! This means `#` should be put in as `%23` for instance.
149
+ :hosts => { :validate => :uri, :default => [ DEFAULT_HOST ], :list => true },
150
+
151
+ # Cloud ID, from the Elastic Cloud web console. If set `hosts` should not be used.
152
+ #
153
+ # For more details, check out the https://www.elastic.co/guide/en/logstash/current/connecting-to-cloud.html#_cloud_id[cloud documentation]
154
+ :cloud_id => { :validate => :string },
155
+
156
+ # Set initial interval in seconds between bulk retries. Doubled on each retry up to `retry_max_interval`
157
+ :retry_initial_interval => { :validate => :number, :default => 2 },
158
+
159
+ # Set max interval in seconds between bulk retries.
160
+ :retry_max_interval => { :validate => :number, :default => 64 }
161
+ }.freeze
162
+
163
+ def self.included(base)
164
+ CONFIG_PARAMS.each { |name, opts| base.config(name, opts) }
161
165
  end
162
166
  end
163
167
  end; end; end