Commit graph

119 commits

Author SHA1 Message Date
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
Rob Bavey
7952046eb8
Soften deprecation language and point module deprecations to agent in… (#13338)
* Soften deprecation language and point module deprecations to agent integrations

* Remove extra `and`

Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>

Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2021-10-26 09:39:42 -04: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
Andrea Selva
2e6ed1d7e4
Fixes to build and run Logstah on JDK 17 (#13306) (#13331)
Backport #13306 to branch 7.x

(cherry picked from commit 7395641a43)

----

This commit applies all the changes needed to run Logstash on JDK 17:
- opens access to module java.base for packages sun.nio.ch and java.io to run the application and to execute the tests
- removes SecurityManager classes used during Logstash startup
- fix exception type catched in JavaKeyStore tampering test

Related to meta issue #13306
2021-10-18 16:38:38 +02: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
Andrea Selva
82993fa6f1
[backport 7.x] Use LS_JAVA_HOME in favor of JAVA_HOME #12725 (#13213)
Backport of #13204 #13207 to 7.x branch, introduces the LS_JAVA_HOME as preferred environment variable over JAVA_HOME which is deprecated.
2021-09-08 15:20:34 +02: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
Andrea Selva
5a9048c4df
Fix Date class clash when used in pipelines with Date filter and GeoIP and pin open-ssl to 0.10.5 (#12811) (#12812)
This commit contains two fixes
* Fix Date class clash when used in pipelines with Date filter and GeoIP
* Pinned jruby-openssl version 0.10.5 to avoid SSL errors

(cherry picked from commit 6f55066b17)
2021-04-13 15:20:12 +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
aba562e887
[backport 7x] hash function of pipeline config with metadata (#12425)
add metadata in the hash function

Fixed #12387
2020-11-09 15:36:50 +01: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
Rob Bavey
b2c652bf9d Ensure more gradle tasks using task avoidance API
Release Manager builds were failing as `downloadEs` task was being
needlessly run during `rake artifact:all` task. When run with
`RELEASE=1`. this was causing build failures due to the non-availability
of Elasticsearch release artifacts. This commit aims to avoid running
the `downloadES` task when it is not needed, continuing the work done
in #11914

This commit also removes code that was repeated in different parts of
the build script.
2020-07-13 20:39:00 +00:00
Colin Surprenant
40a807d4e6 do not call agent.converge_state_and_update before agent.execute 2020-06-30 18:14:26 +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
Rob Bavey
e810f96e6a Use BUILD_JAVA_HOME FOR JAVA_HOME in xpack integration tests 2020-06-04 14:33:51 +00: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
Rob Bavey
b2da4449a5
Use task avoidance API in gradle scripts (#11914) (#11943)
* Use task avoidance API in gradle scripts

This commit uses the task avoidance api (tasks.register vs task.create/
task DSL), as recommended since Gradle 5.1

This should reduce the execution of unnecessary tasks in build jobs, and
hopefully improve build resiliency and execution time.
2020-05-29 11:52:01 -04:00
Joao Duarte
aeb46de6cc emit deprecation entry for netflow and azure modules
point users towards the beats modules instead
2020-05-29 14:43:40 +00:00
Andrea Selva
c5b6a853d6
Introduced JDK environment variable to explicitly pass the JAVA_HOME to use and defined .ci/ with OS and JDK preferences (#11934) 2020-05-27 16:48:39 +02:00
Colin Surprenant
770d9b2719 remove plugin internal validation call
Fixes #11818
2020-04-23 17:44:19 +00:00
Joao Duarte
c73544f1ed reinstate x-pack.monitoring settings in logstash.yml 2020-04-23 09:38:48 +01: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
Laurent Huet
59e4ac8b86 add proxy support (central management & monitoring)
Fixes #11799
2020-04-20 13:35:36 +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
Rob Bavey
c00c3da95a Incorporate review comments
Fixes #11777
2020-04-13 14:11:07 +00:00
Rob Bavey
d33195750e Fix hard coded constraint on pipeline name for metrics
Fixes #11777
2020-04-13 14:11:07 +00:00