logstash-filter-elasticsearch 3.19.0 → 4.0.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 +4 -4
- data/CHANGELOG.md +9 -11
- data/docs/index.asciidoc +23 -240
- data/lib/logstash/filters/elasticsearch/client.rb +2 -27
- data/lib/logstash/filters/elasticsearch.rb +124 -177
- data/logstash-filter-elasticsearch.gemspec +3 -6
- data/spec/filters/elasticsearch_spec.rb +272 -163
- data/spec/filters/elasticsearch_ssl_spec.rb +17 -0
- data/spec/filters/integration/elasticsearch_spec.rb +2 -9
- metadata +3 -59
- data/lib/logstash/filters/elasticsearch/dsl_executor.rb +0 -140
- data/lib/logstash/filters/elasticsearch/esql_executor.rb +0 -178
- data/spec/filters/elasticsearch_dsl_spec.rb +0 -372
- data/spec/filters/elasticsearch_esql_spec.rb +0 -211
- data/spec/filters/integration/elasticsearch_esql_spec.rb +0 -167
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 015a98dbd36122dd3fc4c74da5744a31f6182f67023f802189cc73e837d5ba7a
|
4
|
+
data.tar.gz: 8f1c3a79c0af3fc4154501d16bf775e01b6aa7575627852cb18954a0dd952d91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3971541568e34c0ef644c250243fefcb48c778b2471f81f5e87a1b59535a6f5ccc2a2c13d57f5123e0577efb80962b85f8096d3d6f70e0721df4f716d705e1
|
7
|
+
data.tar.gz: 5fe74aa6d8179e6dd3d9c69a6d0c81f284035bd82343543132f129be7bfb3355e01678eddbd051d9d4c360e9704f8a234737096e757f710b395b5d366f57936f
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,12 @@
|
|
1
|
-
##
|
2
|
-
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
## 3.17.0
|
11
|
-
- Added support for custom headers [#190](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/190)
|
1
|
+
## 4.0.0
|
2
|
+
- SSL settings that were marked deprecated in version `3.15.0` are now marked obsolete, and will prevent the plugin from starting.
|
3
|
+
- These settings are:
|
4
|
+
- `ca_file`, which should be replaced by `ssl_certificate_authorities`
|
5
|
+
- `keystore`, which should be replaced by `ssl_keystore_path`
|
6
|
+
- `keystore_password`, which should be replaced by `ssl_keystore_password`
|
7
|
+
- `keystore_type`, which should be replaced by `ssl_keystore_password`
|
8
|
+
- `ssl`, which should be replaced by `ssl_enabled`
|
9
|
+
- [#183](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/183)
|
12
10
|
|
13
11
|
## 3.16.2
|
14
12
|
- Add `x-elastic-product-origin` header to Elasticsearch requests [#185](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/185)
|
data/docs/index.asciidoc
CHANGED
@@ -54,7 +54,7 @@ if [type] == "end" {
|
|
54
54
|
|
55
55
|
The example below reproduces the above example but utilises the query_template.
|
56
56
|
This query_template represents a full Elasticsearch query DSL and supports the
|
57
|
-
standard
|
57
|
+
standard Logstash field substitution syntax. The example below issues
|
58
58
|
the same query as the first example but uses the template shown.
|
59
59
|
|
60
60
|
[source,ruby]
|
@@ -110,7 +110,7 @@ Authentication to a secure Elasticsearch cluster is possible using _one_ of the
|
|
110
110
|
* <<plugins-{type}s-{plugin}-user>> AND <<plugins-{type}s-{plugin}-password>>
|
111
111
|
* <<plugins-{type}s-{plugin}-cloud_auth>>
|
112
112
|
* <<plugins-{type}s-{plugin}-api_key>>
|
113
|
-
* <<plugins-{type}s-{plugin}-
|
113
|
+
* <<plugins-{type}s-{plugin}-ssl_keystore_path>> and/or <<plugins-{type}s-{plugin}-ssl_keystore_password>>
|
114
114
|
|
115
115
|
[id="plugins-{type}s-{plugin}-autz"]
|
116
116
|
==== Authorization
|
@@ -118,114 +118,13 @@ Authentication to a secure Elasticsearch cluster is possible using _one_ of the
|
|
118
118
|
Authorization to a secure Elasticsearch cluster requires `read` permission at index level and `monitoring` permissions at cluster level.
|
119
119
|
The `monitoring` permission at cluster level is necessary to perform periodic connectivity checks.
|
120
120
|
|
121
|
-
[id="plugins-{type}s-{plugin}-esql"]
|
122
|
-
==== {esql} support
|
123
|
-
|
124
|
-
.Technical Preview
|
125
|
-
****
|
126
|
-
The {esql} feature that allows using ES|QL queries with this plugin is in Technical Preview.
|
127
|
-
Configuration options and implementation details are subject to change in minor releases without being preceded by deprecation warnings.
|
128
|
-
****
|
129
|
-
|
130
|
-
{es} Query Language ({esql}) provides a SQL-like interface for querying your {es} data.
|
131
|
-
|
132
|
-
To use {esql}, this plugin needs to be installed in {ls} 8.17.4 or newer, and must be connected to {es} 8.11 or newer.
|
133
|
-
|
134
|
-
To configure {esql} query in the plugin, set your {esql} query in the `query` parameter.
|
135
|
-
|
136
|
-
IMPORTANT: We recommend understanding {ref}/esql-limitations.html[{esql} current limitations] before using it in production environments.
|
137
|
-
|
138
|
-
The following is a basic {esql} query that sets the food name to transaction event based on upstream event's food ID:
|
139
|
-
[source, ruby]
|
140
|
-
filter {
|
141
|
-
elasticsearch {
|
142
|
-
hosts => [ 'https://..']
|
143
|
-
api_key => '....'
|
144
|
-
query => '
|
145
|
-
FROM food-index
|
146
|
-
| WHERE id == ?food_id
|
147
|
-
'
|
148
|
-
query_params => {
|
149
|
-
"food_id" => "[food][id]"
|
150
|
-
}
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
Set `config.support_escapes: true` in `logstash.yml` if you need to escape special chars in the query.
|
155
|
-
|
156
|
-
In the result event, the plugin sets total result size in `[@metadata][total_values]` field.
|
157
|
-
|
158
|
-
[id="plugins-{type}s-{plugin}-esql-event-mapping"]
|
159
|
-
===== Mapping {esql} result to {ls} event
|
160
|
-
{esql} returns query results in a structured tabular format, where data is organized into _columns_ (fields) and _values_ (entries).
|
161
|
-
The plugin maps each value entry to an event, populating corresponding fields.
|
162
|
-
For example, a query might produce a table like:
|
163
|
-
|
164
|
-
[cols="2,1,1,1,2",options="header"]
|
165
|
-
|===
|
166
|
-
|`timestamp` |`user_id` | `action` | `status.code` | `status.desc`
|
167
|
-
|
168
|
-
|2025-04-10T12:00:00 |123 |login |200 | Success
|
169
|
-
|2025-04-10T12:05:00 |456 |purchase |403 | Forbidden (unauthorized user)
|
170
|
-
|===
|
171
|
-
|
172
|
-
For this case, the plugin creates two JSON look like objects as below and places them into the `target` field of the event if `target` is defined.
|
173
|
-
If `target` is not defined, the plugin places the _only_ first result at the root of the event.
|
174
|
-
[source, json]
|
175
|
-
[
|
176
|
-
{
|
177
|
-
"timestamp": "2025-04-10T12:00:00",
|
178
|
-
"user_id": 123,
|
179
|
-
"action": "login",
|
180
|
-
"status": {
|
181
|
-
"code": 200,
|
182
|
-
"desc": "Success"
|
183
|
-
}
|
184
|
-
},
|
185
|
-
{
|
186
|
-
"timestamp": "2025-04-10T12:05:00",
|
187
|
-
"user_id": 456,
|
188
|
-
"action": "purchase",
|
189
|
-
"status": {
|
190
|
-
"code": 403,
|
191
|
-
"desc": "Forbidden (unauthorized user)"
|
192
|
-
}
|
193
|
-
}
|
194
|
-
]
|
195
|
-
|
196
|
-
NOTE: If your index has a mapping with sub-objects where `status.code` and `status.desc` actually dotted fields, they appear in {ls} events as a nested structure.
|
197
|
-
|
198
|
-
[id="plugins-{type}s-{plugin}-esql-multifields"]
|
199
|
-
===== Conflict on multi-fields
|
200
|
-
|
201
|
-
{esql} query fetches all parent and sub-fields fields if your {es} index has https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/multi-fields[multi-fields] or https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/subobjects[subobjects].
|
202
|
-
Since {ls} events cannot contain parent field's concrete value and sub-field values together, the plugin ignores sub-fields with warning and includes parent.
|
203
|
-
We recommend using the `RENAME` (or `DROP` to avoid warning) keyword in your {esql} query explicitly rename the fields to include sub-fields into the event.
|
204
|
-
|
205
|
-
This is a common occurrence if your template or mapping follows the pattern of always indexing strings as "text" (`field`) + " keyword" (`field.keyword`) multi-field.
|
206
|
-
In this case it's recommended to do `KEEP field` if the string is identical and there is only one subfield as the engine will optimize and retrieve the keyword, otherwise you can do `KEEP field.keyword | RENAME field.keyword as field`.
|
207
|
-
|
208
|
-
To illustrate the situation with example, assuming your mapping has a time `time` field with `time.min` and `time.max` sub-fields as following:
|
209
|
-
[source, ruby]
|
210
|
-
"properties": {
|
211
|
-
"time": { "type": "long" },
|
212
|
-
"time.min": { "type": "long" },
|
213
|
-
"time.max": { "type": "long" }
|
214
|
-
}
|
215
|
-
|
216
|
-
The {esql} result will contain all three fields but the plugin cannot map them into {ls} event.
|
217
|
-
To avoid this, you can use the `RENAME` keyword to rename the `time` parent field to get all three fields with unique fields.
|
218
|
-
[source, ruby]
|
219
|
-
...
|
220
|
-
query => 'FROM my-index | RENAME time AS time.current'
|
221
|
-
...
|
222
|
-
|
223
|
-
For comprehensive ES|QL syntax reference and best practices, see the https://www.elastic.co/guide/en/elasticsearch/reference/current/esql-syntax.html[{esql} documentation].
|
224
|
-
|
225
121
|
[id="plugins-{type}s-{plugin}-options"]
|
226
122
|
==== Elasticsearch Filter Configuration Options
|
227
123
|
|
228
|
-
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>>
|
124
|
+
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
|
125
|
+
|
126
|
+
NOTE: As of version `4.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed. Please see the
|
127
|
+
<<plugins-{type}s-{plugin}-obsolete-options>> for more details.
|
229
128
|
|
230
129
|
[cols="<,<,<",options="header",]
|
231
130
|
|=======================================================================
|
@@ -235,7 +134,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
235
134
|
| <<plugins-{type}s-{plugin}-ca_trusted_fingerprint>> |<<string,string>>|No
|
236
135
|
| <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
|
237
136
|
| <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
|
238
|
-
| <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
|
239
137
|
| <<plugins-{type}s-{plugin}-docinfo_fields>> |<<hash,hash>>|No
|
240
138
|
| <<plugins-{type}s-{plugin}-enable_sort>> |<<boolean,boolean>>|No
|
241
139
|
| <<plugins-{type}s-{plugin}-fields>> |<<array,array>>|No
|
@@ -244,14 +142,11 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
244
142
|
| <<plugins-{type}s-{plugin}-password>> |<<password,password>>|No
|
245
143
|
| <<plugins-{type}s-{plugin}-proxy>> |<<uri,uri>>|No
|
246
144
|
| <<plugins-{type}s-{plugin}-query>> |<<string,string>>|No
|
247
|
-
| <<plugins-{type}s-{plugin}-query_type>> |<<string,string>>, one of `["dsl", "esql"]`|No
|
248
|
-
| <<plugins-{type}s-{plugin}-query_params>> |<<hash,hash>> or <<hash,hash>>|No
|
249
145
|
| <<plugins-{type}s-{plugin}-query_template>> |<<string,string>>|No
|
250
146
|
| <<plugins-{type}s-{plugin}-result_size>> |<<number,number>>|No
|
251
147
|
| <<plugins-{type}s-{plugin}-retry_on_failure>> |<<number,number>>|No
|
252
148
|
| <<plugins-{type}s-{plugin}-retry_on_status>> |<<array,array>>|No
|
253
149
|
| <<plugins-{type}s-{plugin}-sort>> |<<string,string>>|No
|
254
|
-
| <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|__Deprecated__
|
255
150
|
| <<plugins-{type}s-{plugin}-ssl_certificate>> |<<path,path>>|No
|
256
151
|
| <<plugins-{type}s-{plugin}-ssl_certificate_authorities>> |list of <<path,path>>|No
|
257
152
|
| <<plugins-{type}s-{plugin}-ssl_cipher_suites>> |list of <<string,string>>|No
|
@@ -266,7 +161,6 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
266
161
|
| <<plugins-{type}s-{plugin}-ssl_truststore_type>> |<<string,string>>|No
|
267
162
|
| <<plugins-{type}s-{plugin}-ssl_verification_mode>> |<<string,string>>, one of `["full", "none"]`|No
|
268
163
|
| <<plugins-{type}s-{plugin}-tag_on_failure>> |<<array,array>>|No
|
269
|
-
| <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
|
270
164
|
| <<plugins-{type}s-{plugin}-user>> |<<string,string>>|No
|
271
165
|
|=======================================================================
|
272
166
|
|
@@ -280,11 +174,8 @@ filter plugins.
|
|
280
174
|
|
281
175
|
* Value type is <<hash,hash>>
|
282
176
|
* Default value is `{}`
|
283
|
-
* Format: `"aggregation_name" => "[path][on][event]"`:
|
284
|
-
** `aggregation_name`: aggregation name in result from {es}
|
285
|
-
** `[path][on][event]`: path for where to place the value on the current event, using field-reference notation
|
286
177
|
|
287
|
-
|
178
|
+
Hash of aggregation names to copy from elasticsearch response into Logstash event fields
|
288
179
|
|
289
180
|
Example:
|
290
181
|
[source,ruby]
|
@@ -339,26 +230,13 @@ Cloud ID, from the Elastic Cloud web console. If set `hosts` should not be used.
|
|
339
230
|
For more info, check out the
|
340
231
|
{logstash-ref}/connecting-to-cloud.html[Logstash-to-Cloud documentation].
|
341
232
|
|
342
|
-
|
343
|
-
[id="plugins-{type}s-{plugin}-custom_headers"]
|
344
|
-
===== `custom_headers`
|
345
|
-
|
346
|
-
* Value type is <<hash,hash>>
|
347
|
-
* Default value is empty
|
348
|
-
|
349
|
-
Pass a set of key value pairs as the headers sent in each request to Elasticsearch.
|
350
|
-
These custom headers will override any headers previously set by the plugin such as the User Agent or Authorization headers.
|
351
|
-
|
352
233
|
[id="plugins-{type}s-{plugin}-docinfo_fields"]
|
353
234
|
===== `docinfo_fields`
|
354
235
|
|
355
236
|
* Value type is <<hash,hash>>
|
356
237
|
* Default value is `{}`
|
357
|
-
* Format: `"path.in.source" => "[path][on][event]"`:
|
358
|
-
** `path.in.source`: field path in document source of result from {es}, using dot-notation
|
359
|
-
** `[path][on][event]`: path for where to place the value on the current event, using field-reference notation
|
360
238
|
|
361
|
-
|
239
|
+
Hash of docinfo fields to copy from old event (found via elasticsearch) into new event
|
362
240
|
|
363
241
|
Example:
|
364
242
|
[source,ruby]
|
@@ -384,11 +262,9 @@ Whether results should be sorted or not
|
|
384
262
|
|
385
263
|
* Value type is <<array,array>>
|
386
264
|
* Default value is `{}`
|
387
|
-
* Format: `"path.in.result" => "[path][on][event]"`:
|
388
|
-
** `path.in.result`: field path in indexed result from {es}, using dot-notation
|
389
|
-
** `[path][on][event]`: path for where to place the value on the current event, using field-reference notation
|
390
265
|
|
391
|
-
|
266
|
+
An array of fields to copy from the old event (found via elasticsearch) into the
|
267
|
+
new event, currently being processed.
|
392
268
|
|
393
269
|
In the following example, the values of `@timestamp` and `event_id` on the event
|
394
270
|
found via elasticsearch are copied to the current event's
|
@@ -443,30 +319,11 @@ environment variables e.g. `proxy => '${LS_PROXY:}'`.
|
|
443
319
|
* Value type is <<string,string>>
|
444
320
|
* There is no default value for this setting.
|
445
321
|
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
string documentation] or {ref}/esql.html[{es} ES|QL documentation] for more information.
|
451
|
-
|
452
|
-
[id="plugins-{type}s-{plugin}-query_type"]
|
453
|
-
===== `query_type`
|
454
|
-
|
455
|
-
* Value can be `dsl` or `esql`
|
456
|
-
* Default value is `dsl`
|
457
|
-
|
458
|
-
Defines the <<plugins-{type}s-{plugin}-query>> shape.
|
459
|
-
When `dsl`, the query shape must be valid {es} JSON-style string.
|
460
|
-
When `esql`, the query shape must be a valid {esql} string and `index`, `query_template` and `sort` parameters are not allowed.
|
461
|
-
|
462
|
-
[id="plugins-{type}s-{plugin}-query_params"]
|
463
|
-
===== `query_params`
|
464
|
-
|
465
|
-
* The value type is <<hash,hash>> or <<array,array>>. When an array provided, the array elements are pairs of `key` and `value`.
|
466
|
-
* There is no default value for this setting
|
322
|
+
Elasticsearch query string. More information is available in the
|
323
|
+
{ref}/query-dsl-query-string-query.html#query-string-syntax[Elasticsearch query
|
324
|
+
string documentation].
|
325
|
+
Use either `query` or `query_template`.
|
467
326
|
|
468
|
-
Named parameters in {esql} to send to {es} together with <<plugins-{type}s-{plugin}-query>>.
|
469
|
-
Visit {ref}/esql-rest.html#esql-rest-params[passing parameters to query page] for more information.
|
470
327
|
|
471
328
|
[id="plugins-{type}s-{plugin}-query_template"]
|
472
329
|
===== `query_template`
|
@@ -655,44 +512,6 @@ WARNING: Setting certificate verification to `none` disables many security benef
|
|
655
512
|
|
656
513
|
Tags the event on failure to look up previous log event information. This can be used in later analysis.
|
657
514
|
|
658
|
-
[id="plugins-{type}s-{plugin}-target"]
|
659
|
-
===== `target`
|
660
|
-
|
661
|
-
* Value type is <<string,string>>
|
662
|
-
* There is no default value for this setting.
|
663
|
-
|
664
|
-
Define the target field for placing the result data.
|
665
|
-
If this setting is omitted, the target will be the root (top level) of the event.
|
666
|
-
It is highly recommended to set when using `query_type=>'esql'` to set all query results into the event.
|
667
|
-
|
668
|
-
When `query_type=>'dsl'`, the destination fields specified in <<plugins-{type}s-{plugin}-fields>>, <<plugins-{type}s-{plugin}-aggregation_fields>>, and <<plugins-{type}s-{plugin}-docinfo_fields>> are relative to this target.
|
669
|
-
|
670
|
-
For example, if you want the data to be put in the `operation` field:
|
671
|
-
[source,ruby]
|
672
|
-
if [type] == "end" {
|
673
|
-
filter {
|
674
|
-
query => "type:start AND transaction:%{[transactionId]}"
|
675
|
-
elasticsearch {
|
676
|
-
target => "transaction"
|
677
|
-
fields => {
|
678
|
-
"@timestamp" => "started"
|
679
|
-
"transaction_id" => "id"
|
680
|
-
}
|
681
|
-
}
|
682
|
-
}
|
683
|
-
}
|
684
|
-
|
685
|
-
`fields` fields will be expanded into a data structure in the `target` field, overall shape looks like this:
|
686
|
-
[source,ruby]
|
687
|
-
{
|
688
|
-
"transaction" => {
|
689
|
-
"started" => "2025-04-29T12:01:46.263Z"
|
690
|
-
"id" => "1234567890"
|
691
|
-
}
|
692
|
-
}
|
693
|
-
|
694
|
-
NOTE: when writing to a field that already exists on the event, the previous value will be overwritten.
|
695
|
-
|
696
515
|
[id="plugins-{type}s-{plugin}-user"]
|
697
516
|
===== `user`
|
698
517
|
|
@@ -702,57 +521,21 @@ NOTE: when writing to a field that already exists on the event, the previous val
|
|
702
521
|
Basic Auth - username
|
703
522
|
|
704
523
|
|
705
|
-
[id="plugins-{type}s-{plugin}-
|
706
|
-
==== Elasticsearch Filter
|
707
|
-
|
708
|
-
This plugin supports the following deprecated configurations.
|
524
|
+
[id="plugins-{type}s-{plugin}-obsolete-options"]
|
525
|
+
==== Elasticsearch Filter Obsolete Configuration Options
|
709
526
|
|
710
|
-
WARNING:
|
527
|
+
WARNING: As of version `4.0.0` of this plugin, some configuration options have been replaced.
|
528
|
+
The plugin will fail to start if it contains any of these obsolete options.
|
711
529
|
|
712
530
|
[cols="<,<,<",options="header",]
|
713
531
|
|=======================================================================
|
714
|
-
|Setting|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
532
|
+
|Setting|Replaced by
|
533
|
+
| ca_file |<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
|
534
|
+
| keystore |<<plugins-{type}s-{plugin}-ssl_keystore_path>>
|
535
|
+
| keystore_password |<<plugins-{type}s-{plugin}-ssl_keystore_password>>
|
536
|
+
| ssl |<<plugins-{type}s-{plugin}-ssl_enabled>>
|
718
537
|
|=======================================================================
|
719
538
|
|
720
|
-
[id="plugins-{type}s-{plugin}-ca_file"]
|
721
|
-
===== `ca_file`
|
722
|
-
deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>]
|
723
|
-
|
724
|
-
* Value type is <<path,path>>
|
725
|
-
* There is no default value for this setting.
|
726
|
-
|
727
|
-
SSL Certificate Authority file
|
728
|
-
|
729
|
-
[id="plugins-{type}s-{plugin}-ssl"]
|
730
|
-
===== `ssl`
|
731
|
-
deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
|
732
|
-
|
733
|
-
* Value type is <<boolean,boolean>>
|
734
|
-
* Default value is `false`
|
735
|
-
|
736
|
-
SSL
|
737
|
-
|
738
|
-
[id="plugins-{type}s-{plugin}-keystore"]
|
739
|
-
===== `keystore`
|
740
|
-
deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_keystore_path>>]
|
741
|
-
|
742
|
-
* Value type is <<path,path>>
|
743
|
-
* There is no default value for this setting.
|
744
|
-
|
745
|
-
The keystore used to present a certificate to the server. It can be either .jks or .p12
|
746
|
-
|
747
|
-
[id="plugins-{type}s-{plugin}-keystore_password"]
|
748
|
-
===== `keystore_password`
|
749
|
-
deprecated[3.15.0, Replaced by <<plugins-{type}s-{plugin}-ssl_keystore_password>>]
|
750
|
-
|
751
|
-
* Value type is <<password,password>>
|
752
|
-
* There is no default value for this setting.
|
753
|
-
|
754
|
-
Set the keystore password
|
755
|
-
|
756
539
|
|
757
540
|
[id="plugins-{type}s-{plugin}-common-options"]
|
758
541
|
include::{include_path}/{type}.asciidoc[]
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "elasticsearch"
|
3
3
|
require "base64"
|
4
|
+
require "elasticsearch/transport/transport/http/manticore"
|
4
5
|
|
5
6
|
|
6
7
|
module LogStash
|
@@ -8,7 +9,6 @@ module LogStash
|
|
8
9
|
class ElasticsearchClient
|
9
10
|
|
10
11
|
attr_reader :client
|
11
|
-
attr_reader :es_transport_client_type
|
12
12
|
|
13
13
|
BUILD_FLAVOR_SERVERLESS = 'serverless'.freeze
|
14
14
|
DEFAULT_EAV_HEADER = { "Elastic-Api-Version" => "2023-10-31" }.freeze
|
@@ -20,8 +20,6 @@ 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
|
-
|
25
23
|
|
26
24
|
transport_options = { }
|
27
25
|
transport_options[:headers] = options.fetch(:serverless, false) ? DEFAULT_EAV_HEADER.dup : {}
|
@@ -29,7 +27,6 @@ module LogStash
|
|
29
27
|
transport_options[:headers].merge!(setup_api_key(api_key))
|
30
28
|
transport_options[:headers].merge!({ 'user-agent' => "#{user_agent}" })
|
31
29
|
transport_options[:headers].merge!(INTERNAL_ORIGIN_HEADER)
|
32
|
-
transport_options[:headers].merge!(custom_headers) unless custom_headers.empty?
|
33
30
|
|
34
31
|
transport_options[:pool_max] = 1000
|
35
32
|
transport_options[:pool_max_per_route] = 100
|
@@ -44,7 +41,7 @@ module LogStash
|
|
44
41
|
|
45
42
|
client_options = {
|
46
43
|
hosts: hosts,
|
47
|
-
transport_class:
|
44
|
+
transport_class: ::Elasticsearch::Transport::Transport::HTTP::Manticore,
|
48
45
|
transport_options: transport_options,
|
49
46
|
ssl: ssl_options,
|
50
47
|
retry_on_failure: options[:retry_on_failure],
|
@@ -58,19 +55,11 @@ module LogStash
|
|
58
55
|
def search(params={})
|
59
56
|
@client.search(params)
|
60
57
|
end
|
61
|
-
|
62
|
-
def esql_query(params={})
|
63
|
-
@client.esql.query(params)
|
64
|
-
end
|
65
58
|
|
66
59
|
def info
|
67
60
|
@client.info
|
68
61
|
end
|
69
62
|
|
70
|
-
def es_version
|
71
|
-
info&.dig('version', 'number')
|
72
|
-
end
|
73
|
-
|
74
63
|
def build_flavor
|
75
64
|
@build_flavor ||= info&.dig('version', 'build_flavor')
|
76
65
|
end
|
@@ -106,20 +95,6 @@ module LogStash
|
|
106
95
|
token = ::Base64.strict_encode64(api_key.value)
|
107
96
|
{ 'Authorization' => "ApiKey #{token}" }
|
108
97
|
end
|
109
|
-
|
110
|
-
def get_transport_client_class
|
111
|
-
# LS-core includes `elasticsearch` gem. The gem is composed of two separate gems: `elasticsearch-api` and `elasticsearch-transport`
|
112
|
-
# And now `elasticsearch-transport` is old, instead we have `elastic-transport`.
|
113
|
-
# LS-core updated `elasticsearch` > 8: https://github.com/elastic/logstash/pull/17161
|
114
|
-
# Following source bits are for the compatibility to support both `elasticsearch-transport` and `elastic-transport` gems
|
115
|
-
require "elasticsearch/transport/transport/http/manticore"
|
116
|
-
es_transport_client_type = "elasticsearch_transport"
|
117
|
-
::Elasticsearch::Transport::Transport::HTTP::Manticore
|
118
|
-
rescue ::LoadError
|
119
|
-
require "elastic/transport/transport/http/manticore"
|
120
|
-
es_transport_client_type = "elastic_transport"
|
121
|
-
::Elastic::Transport::Transport::HTTP::Manticore
|
122
|
-
end
|
123
98
|
end
|
124
99
|
end
|
125
100
|
end
|