logstash-output-elasticsearch 11.3.1-java → 11.4.1-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 +19 -2
- data/Gemfile +2 -1
- data/docs/index.asciidoc +3 -7
- data/lib/logstash/outputs/elasticsearch/data_stream_support.rb +1 -1
- data/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb +40 -16
- data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +5 -9
- data/lib/logstash/outputs/elasticsearch/http_client.rb +1 -2
- data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +3 -6
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json +2196 -288
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-8x.json +2196 -288
- data/logstash-output-elasticsearch.gemspec +2 -2
- data/spec/es_spec_helper.rb +5 -1
- data/spec/fixtures/test_certs/{ca/ca.crt → ca.crt} +0 -0
- data/spec/fixtures/test_certs/{ca/ca.key → ca.key} +0 -0
- data/spec/fixtures/test_certs/test.p12 +0 -0
- data/spec/fixtures/test_certs/test_invalid.crt +36 -0
- data/spec/fixtures/test_certs/test_invalid.key +51 -0
- data/spec/fixtures/test_certs/test_invalid.p12 +0 -0
- data/spec/fixtures/test_certs/test_self_signed.crt +32 -0
- data/spec/fixtures/test_certs/test_self_signed.key +54 -0
- data/spec/fixtures/test_certs/test_self_signed.p12 +0 -0
- data/spec/integration/outputs/ilm_spec.rb +2 -1
- data/spec/integration/outputs/index_spec.rb +87 -43
- data/spec/integration/outputs/ingest_pipeline_spec.rb +2 -1
- data/spec/integration/outputs/no_es_on_startup_spec.rb +12 -6
- data/spec/integration/outputs/retry_spec.rb +2 -1
- data/spec/integration/outputs/sniffer_spec.rb +1 -1
- data/spec/unit/outputs/elasticsearch/http_client/manticore_adapter_spec.rb +6 -5
- data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +1 -1
- data/spec/unit/outputs/elasticsearch_ssl_spec.rb +1 -1
- metadata +22 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c1ce0504aa5082dc3fc958b72019f243c6cad0174bb883612c25eb5d7f8aedfe
|
|
4
|
+
data.tar.gz: 4d28c34d89b5a70a02c10ebd3b8d425111d3902bc58fb9e428acadee4a471646
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1d0680cf639e01b6c2a2a3b8eb87a2ad525764d006fb3cbfadc06c845925d9f1055075265d7327794e326b1a9df67308d85ebefafb38297bd2121499ecc2279
|
|
7
|
+
data.tar.gz: 285bafc2ffa2ae726bdafdb3176c193c7cd20979625e59cd7526445ae5243137e6dad37cc64208bb3494fc45afe44d913f7b7b4188fcf6b25faf1e9fb6a04d06
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 11.4.1
|
|
2
|
+
- Feat: upgrade manticore (http-client) library [#1063](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1063)
|
|
3
|
+
- the underlying changes include latest HttpClient (4.5.13)
|
|
4
|
+
- resolves an old issue with `ssl_certificate_verification => false` still doing some verification logic
|
|
5
|
+
|
|
6
|
+
## 11.4.0
|
|
7
|
+
- Updates ECS templates [#1062](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1062)
|
|
8
|
+
- Updates v1 templates to 1.12.1 for use with Elasticsearch 7.x and 8.x
|
|
9
|
+
- Updates BETA preview of ECS v8 templates for Elasticsearch 7.x and 8.x
|
|
10
|
+
|
|
11
|
+
## 11.3.3
|
|
12
|
+
- Feat: add support for 'traces' data stream type [#1057](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1057)
|
|
13
|
+
|
|
14
|
+
## 11.3.2
|
|
15
|
+
- Refactor: review manticore error handling/logging, logging originating cause in case of connection related error when debug level is enabled [#1029](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1029)
|
|
16
|
+
- Java causes on connection related exceptions will now be extra logged when plugin is logging at debug level
|
|
17
|
+
|
|
1
18
|
## 11.3.1
|
|
2
19
|
- ECS-related fixes [#1046](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1046)
|
|
3
20
|
- Data Streams requirement on ECS is properly enforced when running on Logstash 8, and warned about when running on Logstash 7.
|
|
@@ -9,10 +26,10 @@
|
|
|
9
26
|
- Adds templates for BETA preview of ECS v8 for both Elasticsearch 7.x and 8.x
|
|
10
27
|
|
|
11
28
|
## 11.2.3
|
|
12
|
-
- Downgrade ECS templates, pinning to v1.10.0 of upstream; fixes an issue where ECS templates cannot be installed in Elasticsearch 6.x or 7.1-7.2, since the generated templates include fields of `type: flattened` that was introduced in Elasticsearch 7.3
|
|
29
|
+
- Downgrade ECS templates, pinning to v1.10.0 of upstream; fixes an issue where ECS templates cannot be installed in Elasticsearch 6.x or 7.1-7.2, since the generated templates include fields of `type: flattened` that was introduced in Elasticsearch 7.3. [#1049](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1049)
|
|
13
30
|
|
|
14
31
|
## 11.2.2
|
|
15
|
-
- Update ECS templates from upstream; `ecs_compatiblity => v1` now resolves to templates for ECS v1.12.1 [#1027](https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/1027)
|
|
32
|
+
- Update ECS templates from upstream; `ecs_compatiblity => v1` now resolves to templates for ECS v1.12.1 [#1047](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1047). Fixes [#1027](https://github.com/logstash-plugins/logstash-output-elasticsearch/issues/1027)
|
|
16
33
|
|
|
17
34
|
## 11.2.1
|
|
18
35
|
- Fix referencing Gem classes from global lexical scope [#1044](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1044)
|
data/Gemfile
CHANGED
data/docs/index.asciidoc
CHANGED
|
@@ -117,12 +117,8 @@ output {
|
|
|
117
117
|
|
|
118
118
|
==== Writing to different indices: best practices
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
You cannot use dynamic variable substitution when `ilm_enabled` is `true` and
|
|
123
|
-
when using `ilm_rollover_alias`.
|
|
124
|
-
|
|
125
|
-
================================================================================
|
|
120
|
+
NOTE: You cannot use dynamic variable substitution when `ilm_enabled` is `true`
|
|
121
|
+
and when using `ilm_rollover_alias`.
|
|
126
122
|
|
|
127
123
|
If you're sending events to the same Elasticsearch cluster, but you're targeting different indices you can:
|
|
128
124
|
|
|
@@ -509,7 +505,7 @@ overwritten with a warning.
|
|
|
509
505
|
* Default value is `logs`.
|
|
510
506
|
|
|
511
507
|
The data stream type used to construct the data stream at index time.
|
|
512
|
-
Currently, only `logs`, `metrics` and `
|
|
508
|
+
Currently, only `logs`, `metrics`, `synthetics` and `traces` are supported.
|
|
513
509
|
|
|
514
510
|
[id="plugins-{type}s-{plugin}-doc_as_upsert"]
|
|
515
511
|
===== `doc_as_upsert`
|
|
@@ -18,7 +18,7 @@ module LogStash module Outputs class ElasticSearch
|
|
|
18
18
|
# Defaults to `false` in Logstash 7.x and `auto` starting in Logstash 8.0.
|
|
19
19
|
base.config :data_stream, :validate => ['true', 'false', 'auto']
|
|
20
20
|
|
|
21
|
-
base.config :data_stream_type, :validate => ['logs', 'metrics', 'synthetics'], :default => 'logs'
|
|
21
|
+
base.config :data_stream_type, :validate => ['logs', 'metrics', 'synthetics', 'traces'], :default => 'logs'
|
|
22
22
|
base.config :data_stream_dataset, :validate => :dataset_identifier, :default => 'generic'
|
|
23
23
|
base.config :data_stream_namespace, :validate => :namespace_identifier, :default => 'default'
|
|
24
24
|
|
|
@@ -7,9 +7,9 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
|
7
7
|
class ManticoreAdapter
|
|
8
8
|
attr_reader :manticore, :logger
|
|
9
9
|
|
|
10
|
-
def initialize(logger, options
|
|
10
|
+
def initialize(logger, options)
|
|
11
11
|
@logger = logger
|
|
12
|
-
options = options.
|
|
12
|
+
options = options.dup
|
|
13
13
|
options[:ssl] = options[:ssl] || {}
|
|
14
14
|
|
|
15
15
|
# We manage our own retries directly, so let's disable them here
|
|
@@ -66,23 +66,53 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
|
66
66
|
|
|
67
67
|
request_uri = format_url(url, path)
|
|
68
68
|
request_uri_as_string = remove_double_escaping(request_uri.to_s)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
begin
|
|
70
|
+
resp = @manticore.send(method.downcase, request_uri_as_string, params)
|
|
71
|
+
# Manticore returns lazy responses by default
|
|
72
|
+
# We want to block for our usage, this will wait for the response to finish
|
|
73
|
+
resp.call
|
|
74
|
+
rescue ::Manticore::ManticoreException => e
|
|
75
|
+
log_request_error(e)
|
|
76
|
+
raise ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError.new(e, request_uri_as_string)
|
|
77
|
+
end
|
|
75
78
|
|
|
76
79
|
# 404s are excluded because they are valid codes in the case of
|
|
77
80
|
# template installation. We might need a better story around this later
|
|
78
81
|
# but for our current purposes this is correct
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
code = resp.code
|
|
83
|
+
if code < 200 || code > 299 && code != 404
|
|
84
|
+
raise ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError.new(code, request_uri, body, resp.body)
|
|
81
85
|
end
|
|
82
86
|
|
|
83
87
|
resp
|
|
84
88
|
end
|
|
85
89
|
|
|
90
|
+
def log_request_error(e)
|
|
91
|
+
details = { message: e.message, exception: e.class }
|
|
92
|
+
details[:cause] = e.cause if e.respond_to?(:cause)
|
|
93
|
+
details[:backtrace] = e.backtrace if @logger.debug?
|
|
94
|
+
|
|
95
|
+
level = case e
|
|
96
|
+
when ::Manticore::Timeout
|
|
97
|
+
:debug
|
|
98
|
+
when ::Manticore::UnknownException
|
|
99
|
+
:warn
|
|
100
|
+
else
|
|
101
|
+
:info
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
@logger.send level, "Failed to perform request", details
|
|
105
|
+
log_java_exception(details[:cause], :debug) if details[:cause] && @logger.debug?
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def log_java_exception(e, level = :debug)
|
|
109
|
+
return unless e.is_a?(java.lang.Exception)
|
|
110
|
+
# @logger.name using the same convention as LS does
|
|
111
|
+
logger = self.class.name.gsub('::', '.').downcase
|
|
112
|
+
logger = org.apache.logging.log4j.LogManager.getLogger(logger)
|
|
113
|
+
logger.send(level, '', e) # logger.error('', e) - prints nested causes
|
|
114
|
+
end
|
|
115
|
+
|
|
86
116
|
# Returned urls from this method should be checked for double escaping.
|
|
87
117
|
def format_url(url, path_and_query=nil)
|
|
88
118
|
request_uri = url.clone
|
|
@@ -96,9 +126,6 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
|
96
126
|
|
|
97
127
|
parsed_path_and_query = java.net.URI.new(path_and_query)
|
|
98
128
|
|
|
99
|
-
query = request_uri.query
|
|
100
|
-
parsed_query = parsed_path_and_query.query
|
|
101
|
-
|
|
102
129
|
new_query_parts = [request_uri.query, parsed_path_and_query.query].select do |part|
|
|
103
130
|
part && !part.empty? # Skip empty nil and ""
|
|
104
131
|
end
|
|
@@ -124,8 +151,5 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
|
124
151
|
@manticore.close
|
|
125
152
|
end
|
|
126
153
|
|
|
127
|
-
def host_unreachable_exceptions
|
|
128
|
-
[::Manticore::Timeout,::Manticore::SocketException, ::Manticore::ClientProtocolException, ::Manticore::ResolutionFailure, Manticore::SocketTimeout]
|
|
129
|
-
end
|
|
130
154
|
end
|
|
131
155
|
end; end; end; end
|
|
@@ -8,27 +8,25 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
|
8
8
|
attr_reader :url, :response_code, :request_body, :response_body
|
|
9
9
|
|
|
10
10
|
def initialize(response_code, url, request_body, response_body)
|
|
11
|
+
super("Got response code '#{response_code}' contacting Elasticsearch at URL '#{url}'")
|
|
12
|
+
|
|
11
13
|
@response_code = response_code
|
|
12
14
|
@url = url
|
|
13
15
|
@request_body = request_body
|
|
14
16
|
@response_body = response_body
|
|
15
17
|
end
|
|
16
18
|
|
|
17
|
-
def message
|
|
18
|
-
"Got response code '#{response_code}' contacting Elasticsearch at URL '#{@url}'"
|
|
19
|
-
end
|
|
20
19
|
end
|
|
21
20
|
class HostUnreachableError < Error;
|
|
22
21
|
attr_reader :original_error, :url
|
|
23
22
|
|
|
24
23
|
def initialize(original_error, url)
|
|
24
|
+
super("Elasticsearch Unreachable: [#{url}][#{original_error.class}] #{original_error.message}")
|
|
25
|
+
|
|
25
26
|
@original_error = original_error
|
|
26
27
|
@url = url
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
def message
|
|
30
|
-
"Elasticsearch Unreachable: [#{@url}][#{original_error.class}] #{original_error.message}"
|
|
31
|
-
end
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
attr_reader :logger, :adapter, :sniffing, :sniffer_delay, :resurrect_delay, :healthcheck_path, :sniffing_path, :bulk_path
|
|
@@ -323,9 +321,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
|
323
321
|
end
|
|
324
322
|
|
|
325
323
|
def perform_request_to_url(url, method, path, params={}, body=nil)
|
|
326
|
-
|
|
327
|
-
rescue *@adapter.host_unreachable_exceptions => e
|
|
328
|
-
raise HostUnreachableError.new(e, url), "Could not reach host #{e.class}: #{e.message}"
|
|
324
|
+
@adapter.perform_request(url, method, path, params, body)
|
|
329
325
|
end
|
|
330
326
|
|
|
331
327
|
def normalize_url(uri)
|
|
@@ -322,8 +322,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
|
322
322
|
|
|
323
323
|
adapter_options[:headers] = client_settings[:headers] if client_settings[:headers]
|
|
324
324
|
|
|
325
|
-
|
|
326
|
-
adapter = adapter_class.new(@logger, adapter_options)
|
|
325
|
+
::LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter.new(@logger, adapter_options)
|
|
327
326
|
end
|
|
328
327
|
|
|
329
328
|
def prepare_user_agent
|
|
@@ -133,12 +133,9 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
|
133
133
|
ssl_options[:keystore_password] = keystore_password.value if keystore_password
|
|
134
134
|
end
|
|
135
135
|
if !params["ssl_certificate_verification"]
|
|
136
|
-
logger.warn
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"** WARNING ** To make sure your data is secure change :ssl_certificate_verification to true"
|
|
140
|
-
].join("\n")
|
|
141
|
-
ssl_options[:verify] = false
|
|
136
|
+
logger.warn "You have enabled encryption but DISABLED certificate verification, " +
|
|
137
|
+
"to make sure your data is secure remove `ssl_certificate_verification => false`"
|
|
138
|
+
ssl_options[:verify] = :disable # false accepts self-signed but still validates hostname
|
|
142
139
|
end
|
|
143
140
|
{ ssl: ssl_options }
|
|
144
141
|
end
|