logstash-output-elasticsearch 9.1.4-java → 9.2.0-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 +3 -0
- data/docs/index.asciidoc +12 -0
- data/lib/logstash/outputs/elasticsearch.rb +3 -0
- data/lib/logstash/outputs/elasticsearch/http_client.rb +8 -5
- data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +2 -1
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/unit/outputs/elasticsearch_spec.rb +18 -0
- 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: 6d35b36dcfe8e22093ba7168cfe5dd86b40aefd706a31dc0264c7c65cec5003e
|
4
|
+
data.tar.gz: 64e0591505d8ea28dc0b739d6b7c0408384aaedbd8dade246ca21d59c3ad3e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96fcb5f6f82c621eff1db8675f510c66550d7fd43b53edbccf0d030081907a13dde42fa2086c0dffc8bea64d210bc6220c696ab02e0319977a441704bd10d920
|
7
|
+
data.tar.gz: d6878897f12cc383206a2412c730f9aee19bd70f090637d32a09ba086db3cf5d8a1132590041de75fd815d6cfd96133c1303feca3ec300e5a9757236bfbae2de
|
data/CHANGELOG.md
CHANGED
data/docs/index.asciidoc
CHANGED
@@ -124,6 +124,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
124
124
|
| <<plugins-{type}s-{plugin}-action>> |<<string,string>>|No
|
125
125
|
| <<plugins-{type}s-{plugin}-bulk_path>> |<<string,string>>|No
|
126
126
|
| <<plugins-{type}s-{plugin}-cacert>> |a valid filesystem path|No
|
127
|
+
| <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
|
127
128
|
| <<plugins-{type}s-{plugin}-doc_as_upsert>> |<<boolean,boolean>>|No
|
128
129
|
| <<plugins-{type}s-{plugin}-document_id>> |<<string,string>>|No
|
129
130
|
| <<plugins-{type}s-{plugin}-document_type>> |<<string,string>>|No
|
@@ -258,6 +259,17 @@ Set the Elasticsearch errors in the whitelist that you don't want to log.
|
|
258
259
|
A useful example is when you want to skip all 409 errors
|
259
260
|
which are `document_already_exists_exception`.
|
260
261
|
|
262
|
+
[id="plugins-{type}s-{plugin}-custom_headers"]
|
263
|
+
===== `custom_headers`
|
264
|
+
|
265
|
+
* Value type is <<hash,hash>>
|
266
|
+
* There is no default value for this setting.
|
267
|
+
|
268
|
+
Pass a set of key value pairs as the headers sent in each request to
|
269
|
+
an elasticsearch node. The headers will be used for any kind of request
|
270
|
+
(_bulk request, template installation, health checks and sniffing).
|
271
|
+
These custom headers will be overidden by settings like `http_compression`.
|
272
|
+
|
261
273
|
[id="plugins-{type}s-{plugin}-healthcheck_path"]
|
262
274
|
===== `healthcheck_path`
|
263
275
|
|
@@ -226,6 +226,9 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
226
226
|
# Enable gzip compression on requests. Note that response compression is on by default for Elasticsearch v5.0 and beyond
|
227
227
|
config :http_compression, :validate => :boolean, :default => false
|
228
228
|
|
229
|
+
# Custom Headers to send on each request to elasticsearch nodes
|
230
|
+
config :custom_headers, :validate => :hash, :default => {}
|
231
|
+
|
229
232
|
def build_client
|
230
233
|
params["metric"] = metric
|
231
234
|
@client ||= ::LogStash::Outputs::ElasticSearch::HttpClientBuilder.build(@logger, @hosts, params)
|
@@ -46,6 +46,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
46
46
|
# * `:ssl` - Boolean. Enable or disable SSL/TLS.
|
47
47
|
# * `:proxy` - String. Choose a HTTP HTTProxy to use.
|
48
48
|
# * `:path` - String. The leading path for prefixing Elasticsearch
|
49
|
+
# * `:headers` - Hash. Pairs of headers and their values
|
49
50
|
# requests. This is sometimes used if you are proxying Elasticsearch access
|
50
51
|
# through a special http path, such as using mod_rewrite.
|
51
52
|
def initialize(options={})
|
@@ -53,11 +54,11 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
53
54
|
@metric = options[:metric]
|
54
55
|
@bulk_request_metrics = @metric.namespace(:bulk_requests)
|
55
56
|
@bulk_response_metrics = @bulk_request_metrics.namespace(:responses)
|
56
|
-
|
57
|
+
|
57
58
|
# Again, in case we use DEFAULT_OPTIONS in the future, uncomment this.
|
58
59
|
# @options = DEFAULT_OPTIONS.merge(options)
|
59
60
|
@options = options
|
60
|
-
|
61
|
+
|
61
62
|
@url_template = build_url_template
|
62
63
|
|
63
64
|
@pool = build_pool(@options)
|
@@ -65,7 +66,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
65
66
|
# connection pool at the same time
|
66
67
|
@bulk_path = @options[:bulk_path]
|
67
68
|
end
|
68
|
-
|
69
|
+
|
69
70
|
def build_url_template
|
70
71
|
{
|
71
72
|
:scheme => self.scheme,
|
@@ -138,7 +139,7 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
138
139
|
|
139
140
|
def bulk_send(body_stream)
|
140
141
|
params = http_compression ? {:headers => {"Content-Encoding" => "gzip"}} : {}
|
141
|
-
# Discard the URL
|
142
|
+
# Discard the URL
|
142
143
|
response = @pool.post(@bulk_path, params, body_stream.string)
|
143
144
|
if !body_stream.closed?
|
144
145
|
body_stream.truncate(0)
|
@@ -274,7 +275,9 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
274
275
|
end
|
275
276
|
|
276
277
|
adapter_options[:ssl] = ssl_options if self.scheme == 'https'
|
277
|
-
|
278
|
+
|
279
|
+
adapter_options[:headers] = client_settings[:headers] if client_settings[:headers]
|
280
|
+
|
278
281
|
adapter_class = ::LogStash::Outputs::ElasticSearch::HttpClient::ManticoreAdapter
|
279
282
|
adapter = adapter_class.new(@logger, adapter_options)
|
280
283
|
end
|
@@ -7,7 +7,8 @@ module LogStash; module Outputs; class ElasticSearch;
|
|
7
7
|
:pool_max => params["pool_max"],
|
8
8
|
:pool_max_per_route => params["pool_max_per_route"],
|
9
9
|
:check_connection_timeout => params["validate_after_inactivity"],
|
10
|
-
:http_compression => params["http_compression"]
|
10
|
+
:http_compression => params["http_compression"],
|
11
|
+
:headers => params["custom_headers"]
|
11
12
|
}
|
12
13
|
|
13
14
|
client_settings[:proxy] = params["proxy"] if params["proxy"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '9.
|
3
|
+
s.version = '9.2.0'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Stores logs in Elasticsearch"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -555,4 +555,22 @@ describe LogStash::Outputs::ElasticSearch do
|
|
555
555
|
end
|
556
556
|
end
|
557
557
|
end
|
558
|
+
|
559
|
+
describe "custom headers" do
|
560
|
+
let(:manticore_options) { subject.client.pool.adapter.manticore.instance_variable_get(:@options) }
|
561
|
+
|
562
|
+
context "when set" do
|
563
|
+
let(:headers) { { "X-Thing" => "Test" } }
|
564
|
+
let(:options) { { "custom_headers" => headers } }
|
565
|
+
it "should use the custom headers in the adapter options" do
|
566
|
+
expect(manticore_options[:headers]).to eq(headers)
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
context "when not set" do
|
571
|
+
it "should have no headers" do
|
572
|
+
expect(manticore_options[:headers]).to be_empty
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
558
576
|
end
|
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: 9.
|
4
|
+
version: 9.2.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|