Commit graph

58 commits

Author SHA1 Message Date
github-actions[bot]
c998741aa5
Fix the Bootstrap check test failure on Windows. (#15975) (#15991)
(cherry picked from commit 19637143e6)

Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com>
2024-03-11 10:15:08 +02:00
github-actions[bot]
c814c8fdd0
Fix geoip database download does not respect http_proxy setting (#14048) (#14053)
This commit adds `http_proxy` to geoip database download option to respect proxy setting

Fixed: #14047
(cherry picked from commit 1c851bb15c)

Co-authored-by: kaisecheng <69120390+kaisecheng@users.noreply.github.com>
2022-04-29 17:00:27 +01:00
github-actions[bot]
2c253c563e
Backport PR #13689 to 7.17: Update failing policy in Central Management fetcher and license checker if hit ES down node (#13925)
* Update failing policy in Central Management fetcher and license checker if hit ES down node (#13689)

Wraps the calls to the central management Elasticsearch cluster with the utility class Stud::Try to handle the remote host error when the client used to connect hit a not available node.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
(cherry picked from commit c544ecb380)

* Covered all calls to ES with retryable

* Mocked logger interaction in test after wrapping the client calls with retryable

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
2022-04-12 11:19:51 +01:00
Ry Biesemeyer
fb68365e45
geoip-db: support http_proxy environment variable (#13410) (#13841)
(cherry picked from commit 022072c437)
2022-03-04 11:00:36 -08:00
kaisecheng
d2a98a0b77
Support env variable in condition (#13608) (#13678)
This PR substitutes ${VAR} in Expression, except RegexValueExpression, with the value in secret store, env.
The substitution happens after syntax parsing and before graph execution.

Fixed: #5115
2022-01-25 16:22:37 -08:00
Ry Biesemeyer
ddb1ed17c2
Product origin headers to Logstash-controlled Elasticsearch clients (#13563) (#13623)
* add product origin header to license checks

* add origin header to Central Management config fetcher

* add origin header to ES output for Monitoring pipeline

(cherry picked from commit 2892964ba1)
2022-01-14 08:10:28 -08:00
kaisecheng
d1e2816c47
Fix unknown type warning of geoip metrics (#13382) (#13602)
This commit changes the value of the geoip metric from Symbol to String to remove warning and refactors metrics part

Fixed: #13197
2022-01-11 13:44:47 +00:00
Ry Biesemeyer
003dbb0c8b
propagate master/main branch rename for geoip filter (7.16) (#13413) 2021-11-17 06:57:53 -08:00
Andrea Selva
f6c379e2df
[Backport 7.16] Fixes a usage of deprecated 'http.enabled' to the new 'api.enabled' (#13380) (#13408)
With #13308 configuration namespace that started with `http.` was renamed to `api.`, this commit fix a usage left behind.
Use the new `api.enabled` setting in one place instead of the deprecated `http.enable`.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
(cherry picked from commit 88c80ebb19)
2021-11-16 18:18:58 +01:00
Ry Biesemeyer
0603651ba7
Secure API (Backport to 7.x) (#13342)
* settings: add "deprecated alias" support

A deprecated alias provides a path for renaming a setting.

 - When a deprecated alias is set on its own, a deprecation notice is emitted
   but fetching the canonical setting value will reflect the value set with the
   deprecated alias.
 - When both the canonical setting (new name) and the deprecated alias (old
   name) are specified, it is an error condition.
 - When the value of the deprecated alias is queried, a warning is emitted to
   the logger and only the value explicitly set to the deprecated alias is
   returned.

Additionally, some relevant cleanup is also included:

 - Starting Logstash with invalid settings no longer results in the obtuse "An
   unexpected error occurred" with backtrace and exception data obscuring the
   issue. Instead, a simple message is emitted indicating that the settings are
   invalid along with the originating exception's message.
 - The various settings implementations share a common logger, instead of each
   implementation class providing its own. This is aimed to reduce noise from
   the logs and to ensure specs validating logging do not need to tie so
   closely to implementation details.

* settings: add password-wrapped setting

* settings: make any setting type capable of being nullable

* settings: add `Settings#names` to power programatic iteration

* cli: route CLI-flag deprecations in to deprecation logger

* settings: group API-related settings under `api.*`

retains deprecated aliases, and is fully backward-compatible.

* webserver: cleanup orphaned attr accessors for never-set ivars

* api: pull settings extraction down from agent

This net-no-change refactor introduces a new method `WebServer#from_settings`
that bridges the gap between Logstash settings and Puma-related options, so
that future additions to the API settings don't add complexity to the Agent.

It also has the benefit of initializing the API Rack App and just ONCE, instead
of once per attempted HTTP port.

* api: add optional TLS/SSL

* docs: reference API security settings

* api: when configured securely, bind to all available interfaces by default

* cleanup: remove unused cert artifacts

* tests: generate fresh webserver certificates

* certs: actually add the binary keystores 🤦
2021-10-19 14:13:37 -07:00
kaisecheng
6af35b5b9c
Replace Faraday to Manticore to get rid of jruby-openssl verification error of Let's Encrypt cross-signed DST Root CA X3 (#13273) (#13279)
Fixed: #13278
2021-10-06 12:16:41 +02:00
kaisecheng
1f61038456
update golang image to 1.17.1(#13260) (#13262)
update golang image to 1.17.1 to get rid of expired DST Root CA X3
disable download manager test cases to silent Faraday::SSLError

Fixed: #13261

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2021-10-01 19:29:33 +02:00
kaisecheng
77a6af1ba1
geoip integrate air-gapped bootstrap script (#13104) (#13251)
This PR integrates Elasticsearch bootstrap script to help users keep Logstah geoip plugin run without online update check.
Add `xpack.geoip.download.endpoint` option to config geoip database service endpoint.
Users can point to `http://localhost:8080/overview.json` when using the script to bootstrap nginx docker
2021-09-28 16:23:51 +02:00
kaisecheng
050eb98f0b
fix geoip external DB shutdown nil exception (#13224) (#13225)
Fixed: #13208
2021-09-15 15:30:52 +01:00
kaisecheng
5616462233
Add geoip database metrics to /node/stats API (#13004) (#13020)
This PR adds geoip database status, last update timestamp, download stats counter to Node Stats API
2021-06-23 19:57:25 +02:00
kaisecheng
72e8dc8d9c
fix database manager with multiple pipelines (#12862) (#12995)
This PR adds support to geoip multiple pipelines which have a single instance
to manage database download to avoid individual download per pipeline
2021-06-17 10:44:18 +02:00
kaisecheng
ec8d182ebb
Geoip disable database manager (#12905) (#12906) 2021-05-14 10:39:37 +02:00
kaisecheng
6a338c675c
Geoip use cc indefinitely (#12888) (#12889)
This PR allows using CC database indefinitely if Logstash hasn't used EULA database ever
Fixed: #12859
2021-05-11 18:08:11 +02:00
kaisecheng
68b8fd3a48
change download path for geoip plugin (#12863) (#12875)
The database was downloaded in plugin/vendor
This PR changes the working directory to `path.data`
2021-05-10 14:28:44 +02:00
kaisecheng
3c27f8ab40
GeoIP database copy all files from .tgz alongside database (#12824) (#12826)
This PR changes the behavior of copying license files from .tgz
Originally, only two files, MaxMind LICENSE.txt and COPYRIGHT.txt, are required
Now more files, README.txt and Elastic ToC, are potentially required
Instead of targeting the files, this change copies all content in .tgz
2021-04-15 15:20:20 +02:00
kaisecheng
965c839e74
[7.x] Geoip database service (#12675) | GeoIP clean up database after new download (#12689) | fix broken test case of term of service (#12715) | change domain and endpoint of GeoIP database service (#12727) | GeoIP database add license file (#12777)
GeoIP database service license change

Fixed: #12560
2021-03-26 10:23:37 +01:00
Ry Biesemeyer
cecd774bce
internal-monitoring: use configured ssl verification mode (#12749) (#12750)
Upstream `ElasticsearchOptions#es_options_from_settings` already uses the
setting `elasticsearch.ssl.verification_mode` to produce an appropriate
boolean-valued `ssl_certificate_verification` in our `es_settings` hash, so
we can rely on it instead of re-checking equality with a string.

(cherry picked from commit d5becc0082)
2021-03-16 12:10:35 -07:00
João Duarte
06bee93154
update jruby to 9.2.16.0 (#12699) (#12721)
fix define_method+super calls due to jruby/jruby#6571

(cherry picked from commit 9643a33b99)
2021-03-04 10:10:57 +00:00
Andrea Selva
87af46f161
Temporarly silenced an x-pack monitoring test, waiting to be fixed the root cause issue #12712 (PR #12718)
The fail cause is documented  in issue #12711 

(cherry picked from commit bca169f348)
2021-03-04 11:06:11 +01:00
andsel
275abab171 Fix Logstash pipelines management in case of slow loading pipelines or disabled webserver (#12571)
This commit avoid an error in gathering monitoring information when webserver is disabled or is not yet started;
which could happen with slow loading pipelines or no pipelines defined from the central management UI.

(cherry picked from commit 91996cf2a2)
2021-02-16 09:39:26 -08:00
kaisecheng
958ffa71f0
add wildcard support in xpack pipeline id (#12370) (#12407)
add wildcard support in xpack pipeline id
do the pattern matching with glob
add warning msg to wildcard with legacy api
check invalid pipeline in bootstrap
test cases for invalid checking

Fixed: #10558
2020-11-03 18:51:52 +01:00
kaisecheng
a93d454688 replace direct access of hidden indices with system indices api (#12279)
* replace direct hidden indices access with system indices api

* fulfill backward compatibility

* fix log msg, rename class, simplify response handling

* modularise fetcher
2020-10-06 21:27:28 +02:00
Ry Biesemeyer
04a3852428 specs: don't start ES connection pool when only validating config
Accidentally succeeding at connecting to an HTTP resource that is not a real,
live Elasticsearch (such as an Elastic Cloud instance that has been shut down
and reaped) can cause client initialization to fail.
2020-08-04 09:24:59 +00:00
Colin Surprenant
556865ee88 ignore default username when no password is set
fixes a regression introduced with the api_key support for xpack monitoring and management in #11864 which disabled the possibility to not use any authentication by relying on the default options and only enabling monitoring for example. It now ignores the default username option when no password is explicitly set.
2020-07-13 21:54:10 +00:00
andsel
c6795731f1 Backport to 7.x of PR #11824
Refactor: move PipelineConfig from Ruby to Java

Reimplement the Ruby class PipelinceConfig in Java trying to keep the method signatures to limit the changes in client code, this is a step of other that intend to move all the configuration code in Java language.
Having all that code in Java unlock some reasoning about how to better implement it and probably an improvement in performance during process startup.
Moved also the spec into a JUnit and fixed here and there the failing tests

Closes: #11824
2020-06-26 00:20:43 -07:00
andsel
72f4e2f8e2 Backport of PR #11773 to branch 7.x
Backports a PR that moved code out of LogStash::Compiler to org.logstash.config.ir.ConfigCompiler
2020-06-25 09:05:23 -07:00
Colin Surprenant
5e62c96c19
add support for api_key authentication in xpack management and monitoring. (#11953)
7.x backport of #11864
2020-06-03 10:57:36 -04:00
Ry Biesemeyer
e06d2195d0 settings: deprecate unit-less TimeValue values
We have "required" units for a variety of `TimeValue` settings when they are
provided as a `String`, but unquoted values in YAML have been passed through as
Integers, where we long assumed nanosecond units. This frequently leads to
surprise (e.g., when `config.reload.interval` is set to `60`, we consume 100%
of CPU in a tight loop trying to reload and re-parse the configs every 60
nanoseconds).

By making the setting retain the TimeValue object for the entirety of its
lifecycle, we can issue a deprecation notice the first time an Integer value is
encountered. As a secondary benefit, our usage of the setting value in code
becomes more clear since we are empowered to ask `TimeValue` for a numeric
value in a specific scale.

Fixes #11803
2020-04-20 16:15:49 +00:00
Karol Bucek
ee2d819d44 Fix: cloud_id not propagating from monitoring config
Fixes #11800
2020-04-16 18:52:42 +00:00
Rob Bavey
ba7fd0cedc Handle Boolean Edges
Fixes #11779
2020-04-13 20:09:27 +00:00
Colin Surprenant
f4b9349145 simplify batch classes, do not compute JE empty batches, refactor RE worker loop (#11746)
7.x clean backport or #11737

cleanup RubyArray "rawtypes"
remove all LinkedHashSet from batch and queue classes
avoid processing empty batches in Java worker loop
cleanup AckedReadBatch and MemoryReadBatch
refactor Ruby worker loop similar to Java Execution to not use batch merge
remove QueueBatch merge and replace LinkedHashSet with ArrayList
2020-04-02 16:29:37 -04:00
andsel
d901616373 Adaptations to internal collector to send data directly to monitoring cluster Close 11573 Added check on HTTP server before asking for monitoring data in unit test Fixes #11541
Fixes #11641
2020-03-12 09:25:38 +00:00
João Duarte
1fc169b7f6 Add apache and elastic license headers to source code files (#11673)
* add license header to ruby and java files
* add license header to erb and rake files
* add license headers to gradle files
2020-03-11 11:54:32 +00:00
Karol Bucek
3a1194edc5
Feat: x-pack cloud id/auth for monitoring/management (#11496)
resolves #11488
2020-01-14 21:35:32 +01:00
Joao Duarte
25a0ecddac refactor list of license_types
DRY up the list of license types as there were 10 places that listed the types explicitly

Fixes #11407
2019-12-10 12:31:16 +00:00
Mike Place
a8806b1d49 Fix spec path
Fixes #10561
2019-05-01 11:16:58 +00:00
Mike Place
06d50daf36 Update spec
Fixes #10561
2019-05-01 11:16:58 +00:00
Jordan Johnson-Doyle
78ea83ec07 Inputs expect a NamespacedMetric, not the root metric instance
Fixes #10614
2019-04-11 13:10:17 +00:00
Ry Biesemeyer
4a79246dd1 add DeprecatedSetting to ease 7.0 transition of xpack config renames
Fixes #10623
2019-04-02 22:40:45 +00:00
Jake Landis
7ca98d3410 Central management typeless API
This commit adopts Elasticsearch's typeless API for central management.

Relates: https://github.com/elastic/elasticsearch/issues/3863

Fixes #10421
2019-03-07 16:19:17 +00:00
Joao Duarte
29280c1527 mute metrics_spec line 138 test
Fixes #10412
2019-02-07 16:25:45 +00:00
Joao Duarte
c1a78c0d59 mute frequently failing x-pack test
Fixes #10396
2019-02-06 09:39:55 +00:00
Ry Biesemeyer
328b83815c spec: make timing-sensitive specs a little more flexible
Fixes #10392
2019-02-06 07:48:57 +00:00
Ry Biesemeyer
149684d5b6 spec: noop refactor for clarity - use explicit metric_input subject instead of implicit subject - use rspec/wait full expectation syntax instead of be_falsey/be_truthy - eliminate unused shared examples - incorporate single-use shared examples
Fixes #10392
2019-02-06 07:48:56 +00:00
Colin Surprenant
6990d08be5
rename config option .url and .ca to .hosts and .certificate_authority (#10380) 2019-02-05 17:39:30 -05:00