logstash-filter-elasticsearch 4.0.0 → 4.1.0
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce70bb1953a72a5ce4d0af40226a69cbc1f3b117c797b978cf5d8fec197ddd8e
|
|
4
|
+
data.tar.gz: b0ad6ba97293de4e617eb40d753ac23067446aa0e6f079472f6add2aa0e159ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13675886f681a5cfafda041f7f02f26bf1c1713cf257b9e4021db03207dd021ec248e72c44b12ed130216d8f4203cc713cb0e7c089b8f00efa2428d22f2f0845
|
|
7
|
+
data.tar.gz: 370907463f7ba33797a2f8f7d3069314328170c61392ad65e0b09eb6f57eeca9bc3468f3901b08c85f06abffb585e234a839b66e1d44dc541914489d6861cda4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## 4.1.0
|
|
2
|
+
- Added support for custom headers [#188](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/188)
|
|
3
|
+
|
|
1
4
|
## 4.0.0
|
|
2
5
|
- SSL settings that were marked deprecated in version `3.15.0` are now marked obsolete, and will prevent the plugin from starting.
|
|
3
6
|
- These settings are:
|
data/docs/index.asciidoc
CHANGED
|
@@ -134,6 +134,7 @@ NOTE: As of version `4.0.0` of this plugin, a number of previously deprecated se
|
|
|
134
134
|
| <<plugins-{type}s-{plugin}-ca_trusted_fingerprint>> |<<string,string>>|No
|
|
135
135
|
| <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
|
|
136
136
|
| <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
|
|
137
|
+
| <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
|
|
137
138
|
| <<plugins-{type}s-{plugin}-docinfo_fields>> |<<hash,hash>>|No
|
|
138
139
|
| <<plugins-{type}s-{plugin}-enable_sort>> |<<boolean,boolean>>|No
|
|
139
140
|
| <<plugins-{type}s-{plugin}-fields>> |<<array,array>>|No
|
|
@@ -230,6 +231,16 @@ Cloud ID, from the Elastic Cloud web console. If set `hosts` should not be used.
|
|
|
230
231
|
For more info, check out the
|
|
231
232
|
{logstash-ref}/connecting-to-cloud.html[Logstash-to-Cloud documentation].
|
|
232
233
|
|
|
234
|
+
|
|
235
|
+
[id="plugins-{type}s-{plugin}-custom_headers"]
|
|
236
|
+
===== `custom_headers`
|
|
237
|
+
|
|
238
|
+
* Value type is <<hash,hash>>
|
|
239
|
+
* Default value is empty
|
|
240
|
+
|
|
241
|
+
Pass a set of key value pairs as the headers sent in each request to Elasticsearch.
|
|
242
|
+
These custom headers will override any headers previously set by the plugin such as the User Agent or Authorization headers.
|
|
243
|
+
|
|
233
244
|
[id="plugins-{type}s-{plugin}-docinfo_fields"]
|
|
234
245
|
===== `docinfo_fields`
|
|
235
246
|
|
|
@@ -20,6 +20,8 @@ module LogStash
|
|
|
20
20
|
api_key = options.fetch(:api_key, nil)
|
|
21
21
|
proxy = options.fetch(:proxy, nil)
|
|
22
22
|
user_agent = options[:user_agent]
|
|
23
|
+
custom_headers = options[:custom_headers]
|
|
24
|
+
|
|
23
25
|
|
|
24
26
|
transport_options = { }
|
|
25
27
|
transport_options[:headers] = options.fetch(:serverless, false) ? DEFAULT_EAV_HEADER.dup : {}
|
|
@@ -27,6 +29,7 @@ module LogStash
|
|
|
27
29
|
transport_options[:headers].merge!(setup_api_key(api_key))
|
|
28
30
|
transport_options[:headers].merge!({ 'user-agent' => "#{user_agent}" })
|
|
29
31
|
transport_options[:headers].merge!(INTERNAL_ORIGIN_HEADER)
|
|
32
|
+
transport_options[:headers].merge!(custom_headers) unless custom_headers.empty?
|
|
30
33
|
|
|
31
34
|
transport_options[:pool_max] = 1000
|
|
32
35
|
transport_options[:pool_max_per_route] = 100
|
|
@@ -32,6 +32,9 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
|
32
32
|
# Array of fields to copy from old event (found via elasticsearch) into new event
|
|
33
33
|
config :fields, :validate => :array, :default => {}
|
|
34
34
|
|
|
35
|
+
# Custom headers for Elasticsearch requests
|
|
36
|
+
config :custom_headers, :validate => :hash, :default => {}
|
|
37
|
+
|
|
35
38
|
# Hash of docinfo fields to copy from old event (found via elasticsearch) into new event
|
|
36
39
|
config :docinfo_fields, :validate => :hash, :default => {}
|
|
37
40
|
|
|
@@ -260,7 +263,8 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
|
260
263
|
:ssl => client_ssl_options,
|
|
261
264
|
:retry_on_failure => @retry_on_failure,
|
|
262
265
|
:retry_on_status => @retry_on_status,
|
|
263
|
-
:user_agent => prepare_user_agent
|
|
266
|
+
:user_agent => prepare_user_agent,
|
|
267
|
+
:custom_headers => @custom_headers
|
|
264
268
|
}
|
|
265
269
|
end
|
|
266
270
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
|
|
3
3
|
s.name = 'logstash-filter-elasticsearch'
|
|
4
|
-
s.version = '4.
|
|
4
|
+
s.version = '4.1.0'
|
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
|
6
6
|
s.summary = "Copies fields from previous log events in Elasticsearch to current events "
|
|
7
7
|
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"
|
|
@@ -333,6 +333,30 @@ describe LogStash::Filters::Elasticsearch do
|
|
|
333
333
|
end
|
|
334
334
|
end
|
|
335
335
|
|
|
336
|
+
context "with custom headers" do
|
|
337
|
+
let(:config) do
|
|
338
|
+
{
|
|
339
|
+
"query" => "*",
|
|
340
|
+
"custom_headers" => { "Custom-Header-1" => "Custom Value 1", "Custom-Header-2" => "Custom Value 2" }
|
|
341
|
+
}
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
let(:plugin) { LogStash::Filters::Elasticsearch.new(config) }
|
|
345
|
+
let(:client_double) { double("client") }
|
|
346
|
+
let(:transport_double) { double("transport", options: { transport_options: { headers: config["custom_headers"] } }) }
|
|
347
|
+
|
|
348
|
+
before do
|
|
349
|
+
allow(plugin).to receive(:get_client).and_return(client_double)
|
|
350
|
+
allow(client_double).to receive(:client).and_return(transport_double)
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
it "sets custom headers" do
|
|
354
|
+
plugin.register
|
|
355
|
+
client = plugin.send(:get_client).client
|
|
356
|
+
expect(client.options[:transport_options][:headers]).to match(hash_including(config["custom_headers"]))
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
|
|
336
360
|
context "if query is on nested field" do
|
|
337
361
|
let(:config) do
|
|
338
362
|
{
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-filter-elasticsearch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-01-
|
|
11
|
+
date: 2025-01-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|