Skip to content

Commit c7efc12

Browse files
authored
Merge branch 'main' into cursor
2 parents 2e62a57 + 5f6e8da commit c7efc12

File tree

17 files changed

+372
-231
lines changed

17 files changed

+372
-231
lines changed

.ci/Dockerfile.elasticsearch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY --chown=elasticsearch:elasticsearch spec/fixtures/test_certs/* $es_path/con
1313

1414
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.enabled: true" >> $es_yml; fi
1515
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.key: $es_path/config/test_certs/es.key" >> $es_yml; fi
16-
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.certificate: $es_path/config/test_certs/es.crt" >> $es_yml; fi
16+
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.certificate: $es_path/config/test_certs/es.chain.crt" >> $es_yml; fi
1717
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.certificate_authorities: [ '$es_path/config/test_certs/ca.crt' ]" >> $es_yml; fi
1818
RUN if [ "$SECURE_INTEGRATION" = "true" ] ; then echo "xpack.security.http.ssl.verification_mode: certificate" >> $es_yml; fi
1919
RUN if [ "$SECURE_INTEGRATION" = "true" ] && [ -n "$ES_SSL_SUPPORTED_PROTOCOLS" ] ; then echo "xpack.security.http.ssl.supported_protocols: ${ES_SSL_SUPPORTED_PROTOCOLS}" >> $es_yml; fi

.ci/docker-setup.sh

Lines changed: 0 additions & 60 deletions
This file was deleted.

.ci/setup.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# user_agent requires /etc/protocols, which is provided by netbase.
2+
# https://github.com/jruby/jruby/issues/3955
3+
if [ ! -f "/etc/protocols" ]; then
4+
if [ $(command -v apt-get) ]; then
5+
echo "installing netbase with apt-get"
6+
sudo apt-get install -y netbase
7+
else
8+
echo "installing netbase with yum"
9+
sudo yum install -y netbase
10+
fi
11+
fi

.travis.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import:
44
before_install:
55
- sudo sysctl -w vm.max_map_count=262144 # due ES bootstrap requirements
66

7-
env:
8-
- INTEGRATION=false ELASTIC_STACK_VERSION=7.x
9-
- INTEGRATION=false ELASTIC_STACK_VERSION=8.x
10-
- INTEGRATION=false ELASTIC_STACK_VERSION=7.x SNAPSHOT=true
11-
- INTEGRATION=false ELASTIC_STACK_VERSION=8.x SNAPSHOT=true
12-
- INTEGRATION=false ELASTIC_STACK_VERSION=7.16.3 MANTICORE_VERSION=0.7.1 ELASTICSEARCH_VERSION=7.15.0
13-
- INTEGRATION=true ELASTIC_STACK_VERSION=7.x
14-
- INTEGRATION=true ELASTIC_STACK_VERSION=7.x SNAPSHOT=true LOG_LEVEL=info
15-
- INTEGRATION=true ELASTIC_STACK_VERSION=8.x SNAPSHOT=true LOG_LEVEL=info
16-
- SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=7.x LOG_LEVEL=info
17-
- SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=7.x ES_SSL_SUPPORTED_PROTOCOLS=TLSv1.3
18-
- SECURE_INTEGRATION=true INTEGRATION=true ELASTIC_STACK_VERSION=7.16.3 MANTICORE_VERSION=0.7.1 ELASTICSEARCH_VERSION=7.14.1 LOG_LEVEL=info
7+
jobs:
8+
include:
9+
- stage: "Integration Tests"
10+
env: INTEGRATION=true SNAPSHOT=true LOG_LEVEL=info ELASTIC_STACK_VERSION=7.current
11+
- env: INTEGRATION=true SNAPSHOT=true LOG_LEVEL=info ELASTIC_STACK_VERSION=8.previous
12+
- env: INTEGRATION=true SNAPSHOT=true LOG_LEVEL=info ELASTIC_STACK_VERSION=8.current
13+
- env: INTEGRATION=true SNAPSHOT=true LOG_LEVEL=info ELASTIC_STACK_VERSION=8.next
14+
- env: INTEGRATION=true SNAPSHOT=true LOG_LEVEL=info ELASTIC_STACK_VERSION=8.future
15+
- stage: "Secure Integration Tests"
16+
env: SECURE_INTEGRATION=true INTEGRATION=true LOG_LEVEL=info ELASTIC_STACK_VERSION=8.current SNAPSHOT=true
17+
- env: SECURE_INTEGRATION=true INTEGRATION=true LOG_LEVEL=info ELASTIC_STACK_VERSION=7.current
18+
- env: SECURE_INTEGRATION=true INTEGRATION=true LOG_LEVEL=info ELASTIC_STACK_VERSION=7.current ES_SSL_SUPPORTED_PROTOCOLS=TLSv1.3

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## 5.0.1
2+
- Fix: prevent plugin crash when hits contain illegal structure [#218](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/218)
3+
- When a hit cannot be converted to an event, the input now emits an event tagged with `_elasticsearch_input_failure` with an `[event][original]` containing a JSON-encoded string representation of the entire hit.
4+
5+
## 5.0.0
6+
- SSL settings that were marked deprecated in version `4.17.0` are now marked obsolete, and will prevent the plugin from starting.
7+
- These settings are:
8+
- `ssl`, which should bre replaced by `ssl_enabled`
9+
- `ca_file`, which should bre replaced by `ssl_certificate_authorities`
10+
- `ssl_certificate_verification`, which should bre replaced by `ssl_verification_mode`
11+
- [#213](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/213)
12+
- Add support for custom headers [#207](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/207)
13+
14+
## 4.20.5
15+
- Add `x-elastic-product-origin` header to Elasticsearch requests [#211](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/211)
16+
17+
## 4.20.4
18+
- Fix issue where the `index` parameter was being ignored when using `response_type => aggregations` [#209](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/209)
19+
20+
## 4.20.3
21+
- [DOC] Update link to bypass redirect, resolving directly to correct content [#206](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/206)
22+
123
## 4.20.2
224
- fix case when aggregation returns an error [#204](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/204)
325

docs/index.asciidoc

Lines changed: 52 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ include::{include_path}/plugin_header.asciidoc[]
2323

2424
Read from an Elasticsearch cluster, based on search query results.
2525
This is useful for replaying test logs, reindexing, etc.
26-
You can periodically schedule ingestion using a cron syntax
26+
You can periodically schedule ingestion using a cron syntax
2727
(see `schedule` setting) or run the query one time to load
2828
data into Logstash.
2929

@@ -93,10 +93,23 @@ The plugin logs a warning when ECS is enabled and `target` isn't set.
9393

9494
TIP: Set the `target` option to avoid potential schema conflicts.
9595

96+
[id="plugins-{type}s-{plugin}-failure-handling"]
97+
==== Failure handling
98+
99+
When this input plugin cannot create a structured `Event` from a hit result, it will instead create an `Event` that is tagged with `_elasticsearch_input_failure` whose `[event][original]` is a JSON-encoded string representation of the entire hit.
100+
101+
Common causes are:
102+
103+
- When the hit result contains top-level fields that are {logstash-ref}/processing.html#reserved-fields[reserved in Logstash] but do not have the expected shape. Use the <<plugins-{type}s-{plugin}-target>> directive to avoid conflicts with the top-level namespace.
104+
- When <<plugins-{type}s-{plugin}-docinfo>> is enabled and the docinfo fields cannot be merged into the hit result. Combine <<plugins-{type}s-{plugin}-target>> and <<plugins-{type}s-{plugin}-docinfo_target>> to avoid conflict.
105+
96106
[id="plugins-{type}s-{plugin}-options"]
97107
==== Elasticsearch Input configuration options
98108

99-
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> and the <<plugins-{type}s-{plugin}-deprecated-options>> described later.
109+
This plugin supports these configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
110+
111+
NOTE: As of version `5.0.0` of this plugin, a number of previously deprecated settings related to SSL have been removed.
112+
Please check out <<plugins-{type}s-{plugin}-obsolete-options>> for details.
100113

101114
[cols="<,<,<",options="header",]
102115
|=======================================================================
@@ -106,6 +119,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
106119
| <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
107120
| <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
108121
| <<plugins-{type}s-{plugin}-connect_timeout_seconds>> | <<number,number>>|No
122+
| <<plugins-{type}s-{plugin}-custom_headers>> |<<hash,hash>>|No
109123
| <<plugins-{type}s-{plugin}-docinfo>> |<<boolean,boolean>>|No
110124
| <<plugins-{type}s-{plugin}-docinfo_fields>> |<<array,array>>|No
111125
| <<plugins-{type}s-{plugin}-docinfo_target>> |<<string,string>>|No
@@ -199,8 +213,18 @@ For more info, check out the
199213
The maximum amount of time, in seconds, to wait while establishing a connection to Elasticsearch.
200214
Connect timeouts tend to occur when Elasticsearch or an intermediate proxy is overloaded with requests and has exhausted its connection pool.
201215

216+
[id="plugins-{type}s-{plugin}-custom_headers"]
217+
===== `custom_headers`
218+
219+
* Value type is <<hash,hash>>
220+
* Default value is empty
221+
222+
Pass a set of key value pairs as the headers sent in each request to an elasticsearch node.
223+
The headers will be used for any kind of request.
224+
These custom headers will override any headers previously set by the plugin such as the User Agent or Authorization headers.
225+
202226
[id="plugins-{type}s-{plugin}-docinfo"]
203-
===== `docinfo`
227+
===== `docinfo`
204228

205229
* Value type is <<boolean,boolean>>
206230
* Default value is `false`
@@ -251,7 +275,7 @@ Example
251275

252276

253277
[id="plugins-{type}s-{plugin}-docinfo_fields"]
254-
===== `docinfo_fields`
278+
===== `docinfo_fields`
255279

256280
* Value type is <<array,array>>
257281
* Default value is `["_index", "_type", "_id"]`
@@ -262,7 +286,7 @@ option lists the metadata fields to save in the current event. See
262286
more information.
263287

264288
[id="plugins-{type}s-{plugin}-docinfo_target"]
265-
===== `docinfo_target`
289+
===== `docinfo_target`
266290

267291
* Value type is <<string,string>>
268292
* Default value depends on whether <<plugins-{type}s-{plugin}-ecs_compatibility>> is enabled:
@@ -286,7 +310,7 @@ this option names the field under which to store the metadata fields as subfield
286310
Controls this plugin's compatibility with the {ecs-ref}[Elastic Common Schema (ECS)].
287311

288312
[id="plugins-{type}s-{plugin}-hosts"]
289-
===== `hosts`
313+
===== `hosts`
290314

291315
* Value type is <<array,array>>
292316
* There is no default value for this setting.
@@ -296,18 +320,18 @@ can be either IP, HOST, IP:port, or HOST:port. The port defaults to
296320
9200.
297321

298322
[id="plugins-{type}s-{plugin}-index"]
299-
===== `index`
323+
===== `index`
300324

301325
* Value type is <<string,string>>
302326
* Default value is `"logstash-*"`
303327

304-
The index or alias to search. See {ref}/multi-index.html[Multi Indices
305-
documentation] in the Elasticsearch documentation for more information on how to
306-
reference multiple indices.
307-
328+
The index or alias to search.
329+
Check out {ref}/api-conventions.html#api-multi-index[Multi Indices
330+
documentation] in the Elasticsearch documentation for info on
331+
referencing multiple indices.
308332

309333
[id="plugins-{type}s-{plugin}-password"]
310-
===== `password`
334+
===== `password`
311335

312336
* Value type is <<password,password>>
313337
* There is no default value for this setting.
@@ -327,7 +351,7 @@ An empty string is treated as if proxy was not set, this is useful when using
327351
environment variables e.g. `proxy => '${LS_PROXY:}'`.
328352

329353
[id="plugins-{type}s-{plugin}-query"]
330-
===== `query`
354+
===== `query`
331355

332356
* Value type is <<string,string>>
333357
* Default value is `'{ "sort": [ "_doc" ] }'`
@@ -375,7 +399,7 @@ The default is 0 (no retry). This value should be equal to or greater than zero.
375399
NOTE: Partial failures - such as errors in a subset of all slices - can result in the entire query being retried, which can lead to duplication of data. Avoiding this would require Logstash to store the entire result set of a query in memory which is often not possible.
376400

377401
[id="plugins-{type}s-{plugin}-schedule"]
378-
===== `schedule`
402+
===== `schedule`
379403

380404
* Value type is <<string,string>>
381405
* There is no default value for this setting.
@@ -387,7 +411,7 @@ There is no schedule by default. If no schedule is given, then the statement is
387411
exactly once.
388412

389413
[id="plugins-{type}s-{plugin}-scroll"]
390-
===== `scroll`
414+
===== `scroll`
391415

392416
* Value type is <<string,string>>
393417
* Default value is `"1m"`
@@ -410,7 +434,7 @@ The query requires at least one `sort` field, as described in the <<plugins-{typ
410434
`scroll` uses {ref}/paginate-search-results.html#scroll-search-results[scroll] API to search, which is no longer recommended.
411435

412436
[id="plugins-{type}s-{plugin}-size"]
413-
===== `size`
437+
===== `size`
414438

415439
* Value type is <<number,number>>
416440
* Default value is `1000`
@@ -478,6 +502,8 @@ Enable SSL/TLS secured communication to Elasticsearch cluster.
478502
Leaving this unspecified will use whatever scheme is specified in the URLs listed in <<plugins-{type}s-{plugin}-hosts>> or extracted from the <<plugins-{type}s-{plugin}-cloud_id>>.
479503
If no explicit protocol is specified plain HTTP will be used.
480504

505+
When not explicitly set, SSL will be automatically enabled if any of the specified hosts use HTTPS.
506+
481507
[id="plugins-{type}s-{plugin}-ssl_key"]
482508
===== `ssl_key`
483509
* Value type is <<path,path>>
@@ -598,7 +624,7 @@ It is also possible to target an entry in the event's metadata, which will be av
598624

599625

600626
[id="plugins-{type}s-{plugin}-user"]
601-
===== `user`
627+
===== `user`
602628

603629
* Value type is <<string,string>>
604630
* There is no default value for this setting.
@@ -608,56 +634,21 @@ option when authenticating to the Elasticsearch server. If set to an
608634
empty string authentication will be disabled.
609635

610636

611-
[id="plugins-{type}s-{plugin}-deprecated-options"]
612-
==== Elasticsearch Input deprecated configuration options
637+
[id="plugins-{type}s-{plugin}-obsolete-options"]
638+
==== Elasticsearch Input Obsolete Configuration Options
613639

614-
This plugin supports the following deprecated configurations.
640+
WARNING: As of version `5.0.0` of this plugin, some configuration options have been replaced.
641+
The plugin will fail to start if it contains any of these obsolete options.
615642

616-
WARNING: Deprecated options are subject to removal in future releases.
617643

618-
[cols="<,<,<",options="header",]
644+
[cols="<,<",options="header",]
619645
|=======================================================================
620-
|Setting|Input type|Replaced by
621-
| <<plugins-{type}s-{plugin}-ca_file>> |a valid filesystem path|<<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
622-
| <<plugins-{type}s-{plugin}-ssl>> |<<boolean,boolean>>|<<plugins-{type}s-{plugin}-ssl_enabled>>
623-
| <<plugins-{type}s-{plugin}-ssl_certificate_verification>> |<<boolean,boolean>>|<<plugins-{type}s-{plugin}-ssl_verification_mode>>
646+
|Setting|Replaced by
647+
| ca_file | <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>
648+
| ssl | <<plugins-{type}s-{plugin}-ssl_enabled>>
649+
| ssl_certificate_verification | <<plugins-{type}s-{plugin}-ssl_verification_mode>>
624650
|=======================================================================
625651

626-
[id="plugins-{type}s-{plugin}-ca_file"]
627-
===== `ca_file`
628-
deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_certificate_authorities>>]
629-
630-
* Value type is <<path,path>>
631-
* There is no default value for this setting.
632-
633-
SSL Certificate Authority file in PEM encoded format, must also include any chain certificates as necessary.
634-
635-
[id="plugins-{type}s-{plugin}-ssl"]
636-
===== `ssl`
637-
deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_enabled>>]
638-
639-
* Value type is <<boolean,boolean>>
640-
* Default value is `false`
641-
642-
If enabled, SSL will be used when communicating with the Elasticsearch
643-
server (i.e. HTTPS will be used instead of plain HTTP).
644-
645-
646-
[id="plugins-{type}s-{plugin}-ssl_certificate_verification"]
647-
===== `ssl_certificate_verification`
648-
deprecated[4.17.0, Replaced by <<plugins-{type}s-{plugin}-ssl_verification_mode>>]
649-
650-
* Value type is <<boolean,boolean>>
651-
* Default value is `true`
652-
653-
Option to validate the server's certificate. Disabling this severely compromises security.
654-
When certificate validation is disabled, this plugin implicitly trusts the machine
655-
resolved at the given address without validating its proof-of-identity.
656-
In this scenario, the plugin can transmit credentials to or process data from an untrustworthy
657-
man-in-the-middle or other compromised infrastructure.
658-
More information on the importance of certificate verification:
659-
**https://www.cs.utexas.edu/~shmat/shmat_ccs12.pdf**.
660-
661652
[id="plugins-{type}s-{plugin}-common-options"]
662653
include::{include_path}/{type}.asciidoc[]
663654

0 commit comments

Comments
 (0)