Commit graph

241 commits

Author SHA1 Message Date
github-actions[bot]
86c8b380fd
upgrade ruby-maven-libs to 3.8.9 (#15894) (#16009)
Given that JRuby comes with ruby-maven-libs 3.3.9 this commit upgrades the gem to 3.8.9 and ensures files from 3.3.9 are not included in the distribution.

(cherry picked from commit 59bd376360)

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2024-03-18 14:36:58 +01:00
github-actions[bot]
e5b988fed2
ensure order of jvm options from file and env vars is respected (#15997) (#16004)
Co-authored-by: Andrea Selva <selva.andre@gmail.com>
(cherry picked from commit 43614ede50)

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2024-03-12 09:21:45 +00:00
github-actions[bot]
783b58e7b5
Added :jvm-options-parser subproject to the javaTests task (#15957) (#15958)
Adds a global new task named javaTests which groups both :logstash-core:javaTests and :jvm-options-parser:test to include the JvmOptionParser unit test in javaTests phase.

(cherry picked from commit c30fe46c80)

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
2024-02-19 16:56:49 +01:00
Andrea Selva
52ce3ff8f6
Set Netty's maxOrder options to previous default (#15925)
Updates Netty's configuration of maxOrder to a previously proven value, if not already customised by the user.

Adds a step to the JvmOption parsing tool, which is used to compose the JVM options string to pass down to Logstash at startup.
The added step rework the parsed options to set the allocator max order -Dio.netty.allocator.maxOrder=11 so that the maximum pooled buffer is up to 16MB and not 4MB.
This option is added iff it's not yet specified by the user
2024-02-09 13:49:23 +01:00
João Duarte
905ddd267b
add base64 notice and update generated NOTICE.txt (#15867) 2024-01-29 11:08:50 +00:00
Andrea Selva
7a055c34d1
Fixed definitions of licenses for some dependencies (#15540)
Update some dependency's licenses definitions.
2023-11-07 17:12:28 +01:00
Ry Biesemeyer
70081bbcac
deps: downgrade jruby, keep updated default-gem dependencies (forward-port #15283) (#15369)
* deps: downgrade jruby, keep updated default-gem dependencies (#15283)

forward-ports non-release-branch components of #15283 to `main`

* deps: downgrade jruby, keep updated default-gem dependencies

By downgrading JRuby to 9.4.2.0 we avoid the silent global crash of the
scheduler backing `Concurrent::TimerTask` that occurs when Jruby 9.4.3.0's
invokedynamic promotes a method to run natively, incorrectly.

Upstream bug: https://github.com/jruby/jruby/issues/7904

Along with the downgrade of JRuby itself to 9.4.2.0, we cherry-pick the
updates to gems that were included in the latest JRuby 9.4.3.0 to ensure
we don't back out relevant fixes to stdlib.

We also remove a pinned-dependency on `racc` that is no longer relevant.

Resolves: https://github.com/elastic/logstash/issues/15282

* Imported the licenses for some gems

- cgi
- date
- ffi-binary-libfixposix
- io-console
- net-http
- net-protocol
- reline
- time
- timeout
- uri

* specs: avoid mocking global ::Gem::Dependency::new

* build: remove redundanct dependsOn declaration

* deps: notice use of ffi-binary-libfixposix via Ruby license

this gem is tri-licensed `Ruby` / `EPL-2.0` / `LGPL-2.1-or-later` and
the Ruby license is preferred to EPL when available

---------

Co-authored-by: andsel <selva.andre@gmail.com>

* deps: add license notices for gems moved from default to bundled

---------

Co-authored-by: andsel <selva.andre@gmail.com>
2023-10-03 14:32:28 -07:00
Andres Rodriguez
cf67cb1377
Rubocop: Enable most SpaceInside cops (#15201)
Enabled:
* SpaceInsideArrayLiteralBrackets
* SpaceInsideParens
* SpaceInsidePercentLiteralDelimiters
* SpaceInsideStringInterpolation
* Add enforced style for SpaceInsideStringInterpolation

Enabled without offenses:
* SpaceInsideArrayPercentLiteral
* Layout/SpaceInsideRangeLiteral
* Layout/SpaceInsideReferenceBrackets
2023-07-20 09:49:46 -04:00
Andres Rodriguez
4255a8fd1c
Rubocop: Enable SpaceAround cops (#15196)
* Enable SpaceARoundBlockParameters
* Enable SpaceAroundEqualsInParameterDefault
* Enable SpaceAroundKeyword
* Enable SpaceAroundOperators
* Enable SpaceBeforeBlockBraces, which yields no changes
2023-07-18 21:11:57 -04:00
Andres Rodriguez
acd87a69e7
Rubocop: Enable various EmptyLine cops (#15194)
Disabled:
 * EmptyLineAfterGuardClause
 * EmptyLineAfterMultilineCondition
 * EmptyLinesAroundAccessModifier

Enabled:
 * Layout/EmptyLineAfterMagicComment
 * Layout/EmptyLineBetweenDefs
 * Layout/EmptyLines
 * Layout/EmptyLinesAroundArguments
 * Layout/EmptyLinesAroundAttributeAccessor
 * Layout/EmptyLinesAroundBeginBody
 * Layout/EmptyLinesAroundBlockBody
 * Layout/EmptyLinesAroundExceptionHandlingKeywords
 * Layout/EmptyLinesAroundMethodBody
 * Layout/EmptyLinesAroundModuleBody
2023-07-18 16:49:16 -04:00
Andres Rodriguez
d95a0bba74
Fix deprecated ERB and BigDecimal instances (#15189) 2023-07-18 08:48:01 -04:00
Andres Rodriguez
b63ffea472
Enable SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon (#15180)
Enable SpaceAfterColon, SpaceAfterComma, SpaceAfterSemicolon and fix occurrences.
2023-07-14 16:46:35 -04:00
Andres Rodriguez
26ff2f7db9
Enable Style/TrailingEmptyLines and fix ocurrences (#15179) 2023-07-14 14:46:33 -04:00
Andres Rodriguez
5e34aacc6e
Enable trailing whitespace formating (#15174)
* Enable Layout/TrailingWhitespace cop formation
* Remove Trailing Whitespaces
2023-07-14 13:22:02 -04:00
João Duarte
1d1fa7a471
update commons-io commons-compress jrjackson databind (#15125)
* update commons-io to 2.13.0 and commons-compress to 1.23.0

* update databind and jackson
2023-06-29 09:02:32 +02:00
Andrea Selva
26d1c7ccdb
Update to JRuby 9.4 (#14861)
Set of changes to make Logstash compatible to JRuby 9.4.
Bundle JRuby 9.4.3.0

- Redefine space token in `LSCL`  and `grammar` treetop from `_` which would generated methods in the form `def _0` (deprecated since `2.7`) to `sc`.
- `I18n.t` method doesn't accept hash as second argument
- `URI.encode` has been replaced with same functionality with `URI::Parser.new.escape`
- `YAML.load` needs explicit `fallback: false` to return false when the yaml string is empty (or contains only comments)
- JRuby's  `JavaClass` has been removed, now it can use `java.lang.Class` directly
- explicitly require gem `thwait` to satisfy `require "thwait"` (In `Gemfile.template` and `logstash-core/logstash-core.gemspec`)
- fix not args `clone` to be `def clone(*args)`
- fix `Enumeration.each_slice` which from `Ruby 3.1` is [chainable](https://rubyreferences.github.io/rubychanges/3.1.html#enumerableeach_cons-and-each_slice-return-a-receiver) and doesn't return `nil`. JRuby fixed in https://github.com/jruby/jruby/issues/7015
- Expanded `Down.download` arguments map ca16bbed3c302006967413eb9d3862f2da81f7ae
- Avoid to pass `nil` in the list of couples used in `Hash[ <list of couples> ]` which from Ruby `3.0` generates an `ArgumentError`
- Removed space not allowed between method name and parentheses `initialize (` is forbidden. 29b607dcdef98f81a73ad171639fd13aaa65e243
- With [Ruby 2.7 the `Kernel#open`](https://rubyreferences.github.io/rubychanges/2.7.html#network-and-web) doesn't fallback to `URI#open`, fixed test code that used that to verify open port. e5b70de54c5301f51a767da67294092af0cfafdc
- Avoid to drop `rdoc/` folder from vendored JRuby else `bin/logstash -i irb` would crash, commit b71f73e9c6edb81a7b7ae1305047e506f61c6e8c

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2023-06-28 13:05:43 +02:00
João Duarte
fd2b1ff340
added psych to dependency list and updated NOTICE.txt (#15050)
* replace jruby-complete with jruby-core in build tasks
* place bundler in the rubylib path for testing
2023-05-23 14:16:40 +01:00
Andrea Selva
a126364102
Centralized version definition for snakeyaml and shadow plugin used in buildscripts (#14952)
Create a variable in the Gradle's 'ext' map to store the versions of libraries and plugins used across the various .gradle files.
2023-03-10 16:50:16 +01:00
João Duarte
6911a71178
add license information for snakeyaml (#14886) 2023-02-09 20:04:14 +00:00
João Duarte
15b2d88647
bump snakeyaml to 1.33 (#14881)
ensure logstash-core picks up 1.33 as well from jackson-data format-yaml's
transititive dependency.
2023-02-09 18:20:03 +00:00
Ry Biesemeyer
6e0b365c92
Feature: flow metrics integration (#14518)
* Flow metrics: initial implementation (#14509)

* metrics: eliminate race condition when registering metrics

Ensure our fast-lookup and store tables cannot diverge in a race condition
by wrapping mutation of both in a single mutex and appropriately handle
another thread winning the race to the lock by using the value that it
persisted instead of writing our own.

* metrics: guard against intermediate namespace conflicts

 - ensures our safeguard that prevents using an existing metric as a namespace
   is applied to _intermediate_ nodes, not just the tail-node, eliminating a
   potential crash when sending `fetch_or_store` to a metric object that is not
   expected to respond to `fetch_or_store`.
 - uses the atomic `Concurrent::Map#compute_if_absent` instead of the
   non-atomic `Concurrent::Map#fetch_or_store`, which is prone to
   last-write-wins during contention (as-written, this method is only
   executed under lock and not subject to contention)
 - uses `Enumerable#reduce` to eliminate the need for recursion

* flow: introduce auto-advancing UptimeMetric

* flow: introduce FlowMetric with minimal current/lifetime rates

* flow: initialize pipeline metrics at pipeline start

* Controller and service layer implementation for flow metrics. (#14514)

* Controller and service layer implementation for flow metrics.

* Add flow metrics to unit test and benchmark cli definitions.

* flow: fix tests for metric types to accomodate new one

* Renaming concurrency and backpressure metrics.

Rename `concurrency` to `worker_concurrency ` and `backpressure` to `queue_backpressure` to provide proper scope naming.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>

* metric: register flow metrics only when we have a collector (#14529)

the collector is absent when the pipeline is run in test with a
NullMetricExt, or when the pipeline is explicitly configured to
not collect metrics using `metric.collect: false`.

* Unit tests and integration tests added for flow metrics. (#14527)

* Unit tests and integration tests added for flow metrics.

* Node stat spec and pipeline spec metric updates.

* Metric keys statically imported, implicit error expectation added in metric spec.

* Fix node status API spec after renaming flow metrics.

* Removing flow metric from PipelinesInfo DS (used in peridoci metric snapshot), integration QA updates.

* metric: register flow metrics only when we have a collector (#14529)

the collector is absent when the pipeline is run in test with a
NullMetricExt, or when the pipeline is explicitly configured to
not collect metrics using `metric.collect: false`.

* Unit tests and integration tests added for flow metrics.

* Node stat spec and pipeline spec metric updates.

* Metric keys statically imported, implicit error expectation added in metric spec.

* Fix node status API spec after renaming flow metrics.

* Removing flow metric from PipelinesInfo DS (used in peridoci metric snapshot), integration QA updates.

* Rebasing with feature branch.

* metric: register flow metrics only when we have a collector

the collector is absent when the pipeline is run in test with a
NullMetricExt, or when the pipeline is explicitly configured to
not collect metrics using `metric.collect: false`.

* Apply suggestions from code review

Integration tests updated to test capturing the flow metrics.

* Flow metrics expectation updated in tegration tests.

* flow: refine integration expectations for reloads/monitoring

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
Co-authored-by: Ry Biesemeyer <ry.biesemeyer@elastic.co>
Co-authored-by: Mashhur <mashhur.sattorov@gmail.com>

* metric: add ScaledView with sub-unit precision to UptimeMetric (#14525)

* metric: add ScaledView with sub-unit precision to UptimeMetric

By presenting a _view_ of our metric that maintains sub-unit precision,
we prevent jitter that can be caused by our periodic poller not running at
exactly our configured cadence.

This is especially important as the UptimeMetric is used as the _denominator_ of
several flow metrics, and a capture at 4.999s that truncates to 4s, causes the
rate to be over-reported by ~25%.

The `UptimeMetric.ScaledView` implements `Metric<Number>`, so its full
lossless `BigDecimal` value is accessible to our `FlowMetric` at query time.

* metrics: reduce window for too-frequent-captures bug and document it

* fixup: provide mocked clock to flow metric

* Flow metrics cleanup (#14535)

* flow metrics: code-style and readability pass

* remove unused imports

* cleanup: simplify usage of internal helpers

* flow: migrate internals to use OptionalDouble

* Flow metrics global (#14539)

* flow: add global top-level flows

* docs: add flow metrics

* Top level flow metrics unit tests added. (#14540)

* Top level flow metrics unit tests added.

* Add unit tests when config reloads, make sure top-level flow metrics didn't get reset.

* Apply suggestions from code review

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>

* Validating against Hash test cases updated.

* For the safety check against exact type in unit tests.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>

* docs: section links and clarity in node stats API flow metrics

Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com>
Co-authored-by: Mashhur <mashhur.sattorov@gmail.com>
2022-09-19 14:21:45 -07:00
Rob Bavey
8d41b85498
Manually import CSV gem to work around thread leak (#14507)
* Manually import CSV gem to work around thread leak

The version of CSV included in jruby distributions >= `9.3.0.0` and
< `9.3.8.0` include a bug that triggers a thread leak when calling
`parse_line` in CSV files.

This commit updates the version of the CSV gem to the latest version,
which includes fixes, and remains compatible with ruby 2.6

Relates: https://github.com/jruby/jruby/issues/7346

* Add CSV license info
2022-09-07 14:45:37 -04:00
João Duarte
4cb900ce7e
update flores dependency to at least 0.0.8 (#14437) 2022-08-17 09:56:45 +01:00
João Duarte
ae4a64d9ae
introduce logstash-integration-aws (#14369)
The logstash-integration-aws plugin replaces the underlying individual plugins related to AWS.

This commit also updates the necessary files around license checking.
2022-07-26 10:50:58 +01:00
Andrea Selva
fc13a4ce3e
Mark all not serializable fields as transient (#14240)
With JDK 18, the Javac lint checking was expanded to raise an error on serializable subclasses that contains instance fields which are not serializable themselves.
This could be solved suppressing the warning or marking the field as transient. The majority of classes with this problem inherit transitively from Serializable but are not intended to be serialized (from Java's serialization mechanism) because has the serialVersionUID = 1L which is just a fix to make linter happy, but are not effectively used in a serialization context.

This commit also removes a finalize method, that could be safely be removed.
2022-06-15 09:56:03 +02:00
João Duarte
0191756f4e
Add Github Action workflow for release notes generation (#14236)
Co-authored-by: Mashhur <99575341+mashhurs@users.noreply.github.com>
2022-06-08 22:40:03 +01:00
Ioannis Kakavas
04f3e32ffa
Add licence mapping for netty (#14117)
Include Netty NOTICE.txt

Co-authored-by: João Duarte <jsvduarte@gmail.com>
2022-06-06 11:58:35 +02:00
João Duarte
4d6942c240
update jackson and jackson-databind to 2.13.3 (#13945)
In jackson-databind 2.10, enabling Default Typing requires having a type validator, and while there's an "allow all" validator called LaissezFaireSubTypeValidator, this commit also tightens the validation a bit by narrowing down the allowed classes.

The default typing validator is only applied to the ObjectMapper for CBOR, which is used in the DLQ, leaving the one for JSON as-is.

Other changes:
* make ingest-converter use versions.yml for jackson-databind
* update jrjackson
2022-06-06 09:47:44 +01:00
Ry Biesemeyer
5337cde599
Add support for ca_trusted_fingerprint in Apache HTTP and Manticore (#14120)
* Add support for ca_trusted_fingerprint in Apache HTTP and Manticore

Adds a module `LogStash::Plugins::CATrustedFingerprintSupport`, which can be
included in a plugin class to add a `ca_trusted_fingerprint` option to create
an Apache SSL TrustStrategy that can be used to bypass the TrustManager when
a matching certificate is found on the chain.
2022-05-20 09:31:32 -07:00
Rob Bavey
4a2268a43f
Update jruby version to 9.3.4.0 (#14114)
This commit updates the version of jruby used in Logstash to `9.3.4.0`.

* Updates the references of `jruby` from `9.2.20.1` to `9.3.4.0`
* Updates references/locations of ruby from `2.5.0` to `2.6.0`
* Updates java imports including `org.logstash.util` to be quoted
  * Without quoting the name of the import, the following error is observed in tests:
  * `java.lang.NoClassDefFoundError: org/logstash/Util (wrong name: org/logstash/util)`
  * Maybe an instance of https://github.com/jruby/jruby/issues/4861
* Adds a monkey patch to `require` to resolve compatibility issue between latest `jruby` and `polyglot` gem 
  * The addition of https://github.com/jruby/jruby/pull/7145 to disallow circular
causes, will throw when `polyglot` is thrown into the mix, and stop logstash from
starting and building - any gems that use an exception to determine whether or not
to load the native gem, will trigger the code added in that commit.
  * This commit adds a monkey patch of `require` to rollback the circular cause exception
back to the original cause.
* Removes the use of the deprecated `JavaClass`
* Adds additional `require time` in `generate_build_metadata`
* Rewrites a test helper to avoid potentially calling `~>` on `FalseClass`


Co-authored-by: Joao Duarte <jsvduarte@gmail.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-05-19 10:29:59 -04:00
Rob Bavey
2c7f14d25a
Move JvmOptionParser to separate project (#13657)
This commit moves the JvmOptionParser into its own gradle project.

This enables the JvmOptionParser to remain compatible with Java 1.8 to present a helpful error message to a user attempting to start Logstash using older versions of Java, while allowing the main Logstash code base to freely use idiomatic Java 11 features.
2022-05-18 14:58:53 -04:00
Andrea Selva
32675c1a88
Update Jackson databind in ingest-converter tool (#13900) 2022-03-16 12:33:27 +01:00
Andrea Selva
8c79a0067c
Updates license checker after inclusion of et-orbi, fugit and raabro. (#13891)
These dependencies are Rufus transitive deps, included by JDBC integration plugin v5.2.4
2022-03-14 15:58:48 +01:00
Ry Biesemeyer
f10059ec7b
tools: allow version bump to use local lockfile as baseline (#13686) 2022-03-04 08:44:26 -08:00
Karol Bucek
3637a30e8f
Refactor: drop redundant (jruby-complete.jar) dependency (#13159)
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-02-02 06:55:26 +01:00
Rob Bavey
c5a1cc784e
Regenerate NOTICE file, add new license for elastic enterprise search (#13670) 2022-01-24 14:26:37 -05:00
Andrea Selva
bc760c5c07
Adds license definitions for faraday-multipart and faraday-retry (#13592) 2022-01-10 10:42:20 +01:00
João Duarte
4919286e42
rename references of master branch to main branch (#13301) 2021-11-08 10:23:46 +00:00
kaisecheng
0f433a0814
avoid duplication of heading and index entry in release notes (#13192) 2021-09-29 10:42:20 +02:00
Andrea Selva
728289e862
Switched to Gradle 7 (#13184)
This commit:
- Updates the Gradle wrapper to version 7.2
- Remove the deprecated jcenter and where it was used to retrieve Gradle's plugins it switches to gradlePluginPortal
- Insert an explicit dependency from test task to the log4j.properties manipulation task ("copyProductionLog4jConfiguration") used in integration
2021-09-08 10:42:13 +02:00
Andrea Selva
6ed2eea890
Added rexml notice to license list (#13209) 2021-09-07 11:07:49 +02:00
Andrea Selva
d2237578d5
Feature/remove gradle license report plugin (#13182)
Remove usage of plugin Gradle-License-Report to generate CSV report of used dependencies.
This commit replaces the removed plugin with the custom `ListProjectDependencies` task that inspects Gradle's project dependencies and produces a CSV file containing the list.
2021-09-01 15:28:57 +02:00
Andrea Selva
a7f6c01a3a
Update Snakeyaml version to 1.29 (#13129)
Snakeyaml is used only in the build chain, and it's not packaged with Logstash
2021-08-16 10:33:47 +02:00
Andrea Selva
542dce81a7
Added faraday-* and ruby2_keywords notices to licences list (#13126) 2021-08-13 13:25:47 +02:00
Andrea Selva
b722360ebd
Fix LS benchmarking tool to work with releases >= 7.10.0 (#13052)
Starting with version 7.10.0 the name of LS packages changed, adding os and CPU architecture in the name. This change broke the downloading of those from the benchmarking tool. This commit fixes it, composing correctly the name, based on the version it has to download.
2021-07-06 16:04:29 +02:00
Julien Mailleret
6ae2146a75
Fix UBI source URL (#13008)
This commit fix the source URL for UBI image to ensure that it stays
consistent with the URL generated in
https://artifacts.elastic.co/reports/dependencies/dependencies-current.html
2021-06-21 16:06:10 +02:00
Karen Metts
2e413c6e92
Internal: Update messaging in release notes script (#12949) 2021-05-28 10:41:37 -04:00
Rob Bavey
a935261eeb
Add logstash-integration-elastic_enterprise_search to plugins-metadata.json (#12925)
* Add logstash-integration-elastic_enterprise_search to plugins-metadata.json
* Remove old elastic_app_search plugin and set integration as default
* Add license information for workplace search gem
2021-05-25 17:37:39 -04:00
IvoGoman
7b855820ed
Adds option to pass custom data to the benchmark CLI (#12437) 2021-03-25 15:00:57 -04:00
Rob Bavey
72e26f9957
Fix Benchmarking tool (#12736)
Since the introduction of this block:

```
 "pipeline" : {
    "workers" : 16,
    "batch_size" : 125,
    "batch_delay" : 50
  },
```

to the node stats API, the benchmarking tool has been broken. This commit fixes the
tool, and updates the payload in the tests to reflect the current payload.
2021-03-10 11:19:15 -05:00