logstash-output-elasticsearch 11.3.1-java → 11.3.2-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 +6 -2
- data/docs/index.asciidoc +2 -6
- 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/logstash-output-elasticsearch.gemspec +1 -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
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b716e89a4ab884412f633b3c0e745ab787006466a44b09ca0c20c45410603eea
|
4
|
+
data.tar.gz: '09387e7905fcb56e033cf3b9d8c2db7df3f7d11d8e4dc8e638d3e9ff570f4231'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df0e1ef992ead1c347ef7d528309c732092037186310623aa2b538e086c6eea5cba24bb9aa354d7deeb1718904ff1965a40b3bed2d4c5597c14a8d3f64276a58
|
7
|
+
data.tar.gz: bec8153c3242e4de19410eac06f8e1ee716df545a0d0a2d49b69023901a8b928315409d863581a16f3fb1feb6648ec623ef5f35faf6f707fea64cceddf136e6b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 11.3.2
|
2
|
+
- 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)
|
3
|
+
- Java causes on connection related exceptions will now be extra logged when plugin is logging at debug level
|
4
|
+
|
1
5
|
## 11.3.1
|
2
6
|
- ECS-related fixes [#1046](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1046)
|
3
7
|
- Data Streams requirement on ECS is properly enforced when running on Logstash 8, and warned about when running on Logstash 7.
|
@@ -9,10 +13,10 @@
|
|
9
13
|
- Adds templates for BETA preview of ECS v8 for both Elasticsearch 7.x and 8.x
|
10
14
|
|
11
15
|
## 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
|
16
|
+
- 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
17
|
|
14
18
|
## 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)
|
19
|
+
- 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
20
|
|
17
21
|
## 11.2.1
|
18
22
|
- Fix referencing Gem classes from global lexical scope [#1044](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1044)
|
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
|
|
@@ -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
|
@@ -5,7 +5,7 @@ require "socket"
|
|
5
5
|
|
6
6
|
describe "pool sniffer", :integration => true do
|
7
7
|
let(:logger) { Cabin::Channel.get }
|
8
|
-
let(:adapter) { LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter.new(logger) }
|
8
|
+
let(:adapter) { LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter.new(logger, {}) }
|
9
9
|
let(:es_host) { get_host_port.split(":").first }
|
10
10
|
let(:es_port) { get_host_port.split(":").last }
|
11
11
|
let(:es_ip) { IPSocket.getaddress(es_host) }
|
@@ -10,11 +10,12 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter do
|
|
10
10
|
|
11
11
|
it "should raise an exception if requests are issued after close" do
|
12
12
|
subject.close
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
begin
|
14
|
+
subject.perform_request(::LogStash::Util::SafeURI.new("http://localhost:9200"), :get, '/')
|
15
|
+
fail 'expected to raise a HostUnreachableError'
|
16
|
+
rescue ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError => e
|
17
|
+
expect( e.original_error ).to be_a ::Manticore::ClientStoppedException
|
18
|
+
end
|
18
19
|
end
|
19
20
|
|
20
21
|
describe "auth" do
|
@@ -4,7 +4,7 @@ require 'cabin'
|
|
4
4
|
|
5
5
|
describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
|
6
6
|
let(:logger) { Cabin::Channel.get }
|
7
|
-
let(:adapter) { LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter.new(logger) }
|
7
|
+
let(:adapter) { LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter.new(logger, {}) }
|
8
8
|
let(:initial_urls) { [::LogStash::Util::SafeURI.new("http://localhost:9200")] }
|
9
9
|
let(:options) { {:resurrect_delay => 2, :url_normalizer => proc {|u| u}} } # Shorten the delay a bit to speed up tests
|
10
10
|
let(:es_node_versions) { [ "0.0.0" ] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.3.
|
4
|
+
version: 11.3.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|