logstash-filter-elasticsearch 3.16.2 → 3.17.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: aaf8d73f069f6550d53c38b1a27f5444f77b774bbe62d66b7b7dd276be4125fc
|
4
|
+
data.tar.gz: 19b2d5030a25fd03c78baf5edb6b18a649cc0751fa02f38fdfd8a9959669b9bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3792d01a260e9dcada0ddc7df7aaebbfc1280025781f4c8f2640eaba3abd0d777982f31b794cd7e37b1ce9430bd1f2a60d73dc05ddb8fc0eedd778d9574f1c6
|
7
|
+
data.tar.gz: 0743bccc0a8da98dd91d697ab1b05e95fae2853fd24e8d6db6887ec7ad636de2ae970ff65e15d491388402c702d71adc2190b987a30e5ee2f30a39daf5014954
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 3.17.0
|
2
|
+
- Added support for custom headers [#190](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/190)
|
3
|
+
|
1
4
|
## 3.16.2
|
2
5
|
- Add `x-elastic-product-origin` header to Elasticsearch requests [#185](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/185)
|
3
6
|
|
data/docs/index.asciidoc
CHANGED
@@ -131,6 +131,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
131
131
|
| <<plugins-{type}s-{plugin}-ca_trusted_fingerprint>> |<<string,string>>|No
|
132
132
|
| <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
|
133
133
|
| <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
|
134
|
+
| <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
|
134
135
|
| <<plugins-{type}s-{plugin}-docinfo_fields>> |<<hash,hash>>|No
|
135
136
|
| <<plugins-{type}s-{plugin}-enable_sort>> |<<boolean,boolean>>|No
|
136
137
|
| <<plugins-{type}s-{plugin}-fields>> |<<array,array>>|No
|
@@ -228,6 +229,16 @@ Cloud ID, from the Elastic Cloud web console. If set `hosts` should not be used.
|
|
228
229
|
For more info, check out the
|
229
230
|
{logstash-ref}/connecting-to-cloud.html[Logstash-to-Cloud documentation].
|
230
231
|
|
232
|
+
|
233
|
+
[id="plugins-{type}s-{plugin}-custom_headers"]
|
234
|
+
===== `custom_headers`
|
235
|
+
|
236
|
+
* Value type is <<hash,hash>>
|
237
|
+
* Default value is empty
|
238
|
+
|
239
|
+
Pass a set of key value pairs as the headers sent in each request to Elasticsearch.
|
240
|
+
These custom headers will override any headers previously set by the plugin such as the User Agent or Authorization headers.
|
241
|
+
|
231
242
|
[id="plugins-{type}s-{plugin}-docinfo_fields"]
|
232
243
|
===== `docinfo_fields`
|
233
244
|
|
@@ -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
|
@@ -33,6 +33,9 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
33
33
|
# Array of fields to copy from old event (found via elasticsearch) into new event
|
34
34
|
config :fields, :validate => :array, :default => {}
|
35
35
|
|
36
|
+
# Custom headers for Elasticsearch requests
|
37
|
+
config :custom_headers, :validate => :hash, :default => {}
|
38
|
+
|
36
39
|
# Hash of docinfo fields to copy from old event (found via elasticsearch) into new event
|
37
40
|
config :docinfo_fields, :validate => :hash, :default => {}
|
38
41
|
|
@@ -269,7 +272,8 @@ class LogStash::Filters::Elasticsearch < LogStash::Filters::Base
|
|
269
272
|
:ssl => client_ssl_options,
|
270
273
|
:retry_on_failure => @retry_on_failure,
|
271
274
|
:retry_on_status => @retry_on_status,
|
272
|
-
:user_agent => prepare_user_agent
|
275
|
+
:user_agent => prepare_user_agent,
|
276
|
+
:custom_headers => @custom_headers
|
273
277
|
}
|
274
278
|
end
|
275
279
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-elasticsearch'
|
4
|
-
s.version = '3.
|
4
|
+
s.version = '3.17.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"
|
8
8
|
s.authors = ["Elastic"]
|
9
9
|
s.email = 'info@elastic.co'
|
10
|
-
s.homepage = "
|
10
|
+
s.homepage = "https://elastic.co/logstash"
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
@@ -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: 3.
|
4
|
+
version: 3.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,7 @@ files:
|
|
174
174
|
- spec/filters/fixtures/test_certs/ls.der.sha256
|
175
175
|
- spec/filters/fixtures/test_certs/ls.key
|
176
176
|
- spec/filters/integration/elasticsearch_spec.rb
|
177
|
-
homepage:
|
177
|
+
homepage: https://elastic.co/logstash
|
178
178
|
licenses:
|
179
179
|
- Apache License (2.0)
|
180
180
|
metadata:
|