Commit graph

10505 commits

Author SHA1 Message Date
Andrea Selva
de4f976527
Delete consumed DLQ segments and exposes API to acknowledge read events. (#14188)
Introduce a method (markForDelete) in the DeadLetterQueueReader class as way to get acknowledged when events, read by the input plugin, could be considered eligible for deletion. This mechanism is used to delete the tail segments once they result completely consumed.
Other than this, exposes a listener interface, that the client of this class has to register to get notified when the deletion of a segment happened. This is useful for the DLQ input plugin to understand when it could flush the current position to the sinceDB.

This commit also delete the, eventually present, segments files that are older than the current position, and it happens during the setCurrentReaderAndPosition execution.

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2022-06-14 16:45:23 +02:00
kaisecheng
d63b6ae564
Fix exception of i18n in logstash-keystore (#14246)
This PR adds the load of i18n to LogStash::Settings to fix uninitialized constant I18n exception when using `logstash-keystore`
2022-06-13 18:12:04 +01:00
Sean Story
17700fc70c
14203 fix generated plugin dependencies (#14229)
* Make generated input plugin immediately buildable

* Apply the same changes to codec, filter, and output templates

* Uncomment TODOs in example gemspecs
2022-06-13 10:30:46 -05:00
Andres Rodriguez
0605b75420
[docs] Correctly reference the base OS (ubuntu) for docker (#14214)
* Fix docs to correctly reference the base OS (ubuntu) for docker
2022-06-09 10:00:02 -04: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
github-actions[bot]
805bf063f5
Doc: Add pipeline improvements to release notes (#14193) (#14238)
(cherry picked from commit a78aebcd1e)
Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2022-06-08 17:23:48 -04:00
github-actions[bot]
579515a386
Doc: Add placeholder for 8.3 release notes (#14180) (#14237)
(cherry picked from commit d1f52eac25)
Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2022-06-08 16:25:45 -04:00
Andrea Selva
99e309fe7b
Avoid to throw an exception from a finally block (#14192)
Proposes a code cleanup of the FileLockFactory.obtainLock method. It removes the nesting of ifs using a "precondition style" check, lifting up the error condition, and checking on top of the code flow.

It removed a throw exception from the clean-up finally block.
If an exception is raised from that point it hides the original cause of the problem.
This commit switches the finally block, used in obtaining a file lock, to a catch and re-throw.
2022-06-08 16:26:56 +02:00
Karol Bucek
d2b9b15bc1
Refactor: drop java.util.Collection#inspect extension (#14208)
since JRuby 9.3 a useful inspect is provided out of the box

LS' inspect: <Java::JavaUtil::ArrayList:3536147 ["some"]>
JRuby 9.3's: "#<Java::JavaUtil::ArrayList: [\"some\"]>"
2022-06-07 10:08:32 +02:00
Karol Bucek
433b341f0f
Refactor: avoid loading polyglot (#14175)
* Refactor: require treetop/runtime - avoids loading polyglot
* Build: instruct Bundler not to auto-load polyglot/treetop

+ Build: these deps are properly required as needed
all of them only used in one place (outside of normal bootstrap)
2022-06-07 08:28:56 +02:00
Karol Bucek
2b3e9a1832
Refactor: use Java API for String#split (#14207) 2022-06-07 08:13:13 +02:00
Sean Story
7ab777f4da
Added necessary require, removed instance variable usage of plugin_name (#14206)
* Added necessary require, removed instance variable usage of plugin_name

* Updated usages of plugin_name in codec plugin
2022-06-06 09:48:07 -05: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
Mashhur
886f1caed1
Fix deprecation logging of password policy. (#14159)
* Fix deprecation logging of password policy.
Give users a guide to not only upgrading but also keep current behavior if they really want.

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
2022-06-01 16:47:59 -07:00
Andres Rodriguez
498c41bccc
Remove startup.options and system-install docs (#14197)
Removes documentation related to startup.options and system-install binary as they are no longer used in the latest versions of Logstash.
2022-06-01 12:08:08 -04:00
João Duarte
8d01b1649d
Tighten validation of comment body in PR backport workflow (#14186) 2022-05-30 15:53:15 +01:00
João Duarte
9cbcd68faf
Update pr_backporter.yml 2022-05-30 15:14:13 +01:00
Karol Bucek
c08be755b1
Deps: lock faraday to 1.x due elasticsearch-transport (#14185) 2022-05-30 15:50:38 +02:00
João Duarte
a55034f8a9
Set step id for use in following steps on pr backporter workflow (#14181) 2022-05-30 11:00:46 +01:00
github-actions[bot]
79f02b28e1
Release notes for 8.2.2 (#14168) (#14178)
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
(cherry picked from commit eb5179fb74)
2022-05-26 18:46:56 -04:00
Karen Metts
87e528ac81
Doc: Add missing release notes (#14169) 2022-05-25 18:37:45 -04:00
Andrea Selva
81566e3522
Forward port of release notes for 8.2.0 and 8.2.1 (#14148)
Forward port of release notes for 8.2.0 and 8.2.1

Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2022-05-25 18:21:46 +02:00
kaisecheng
7f36665c09
Handle out-of-date firstUnackedPageNum in head checkpoint (#14147)
This commit adds a checkpoint for a fully acked page before purging to keep the checkpoint up-to-date
Fixed: #6592

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
2022-05-25 14:38:24 +01:00
João Duarte
c1908c4231
Make version bump action "branch" parameter free form (#14162)
Being a "choice" type parameter required frequent PRs every time there's a new minor. This commit changes the field to take a string instead.
2022-05-25 12:15:37 +01:00
João Duarte
83b3c39871
bump version to 8.4.0 (#14161) 2022-05-25 12:12:25 +01:00
kaisecheng
9daffad8ad
update release ci 7.17.4 (#14062) 2022-05-25 10:17:55 +01:00
Andrea Selva
7dff55c8bc
Update CI versions after 8.2.1 (#14137) 2022-05-25 08:48:47 +02:00
Ry Biesemeyer
e3988f534a
Revert accidental (#14158)
* Revert "Improve log readability and remove extra logging."

This reverts commit 67cdbb050d.

* Revert "Password policy deprecation log fixup."

This reverts commit 46b71b1cd4.
2022-05-24 15:15:14 -07:00
mashhur
67cdbb050d Improve log readability and remove extra logging. 2022-05-24 14:58:40 -07:00
mashhur
46b71b1cd4 Password policy deprecation log fixup. 2022-05-24 14:44:05 -07:00
Rob Bavey
ea1690d5ba
update jdk to 11.0.15+10 (#14152)
This commit re-adds the update to jdk 11.0.15+10 originally made in #14031
2022-05-24 11:06:40 -04:00
Ry Biesemeyer
d8454110ba
Field Reference: handle special characters (#14044)
* add failing tests for Event.new with field that look like field references

* fix: correctly handle FieldReference-special characters in field names.

Keys passed to most methods of `ConvertedMap`, based on `IdentityHashMap`
depend on identity and not equivalence, and therefore rely on the keys being
_interned_ strings. In order to avoid hitting the JVM's global String intern
pool (which can have performance problems), operations to normalize a string
to its interned counterpart have traditionally relied on the behaviour of
`FieldReference#from` returning a likely-cached `FieldReference`, that had
an interned `key` and an empty `path`.

This is problematic on two points.

First, when `ConvertedMap` was given data with keys that _were_ valid string
field references representing a nested field (such as `[host][geo][location]`),
the implementation of `ConvertedMap#put` effectively silently discarded the
path components because it assumed them to be empty, and only the key was
kept (`location`).

Second, when `ConvertedMap` was given a map whose keys contained what the
field reference parser considered special characters but _were NOT_
valid field references, the resulting `FieldReference.IllegalSyntaxException`
caused the operation to abort.

Instead of using the `FieldReference` cache, which sits on top of objects whose
`key` and `path`-components are known to have been interned, we introduce an
internment helper on our `ConvertedMap` that is also backed by the global string
intern pool, and ensure that our field references are primed through this pool.

In addition to fixing the `ConvertedMap#newFromMap` functionality, this has
three net effects:

 - Our ConvertedMap operations still use strings
   from the global intern pool
 - We have a new, smaller cache of individual field
   names, improving lookup performance
 - Our FieldReference cache no longer is flooded
   with fragments and therefore is more likely to
   remain performant

NOTE: this does NOT create isolated intern pools, as doing so would require
      a careful audit of the possible code-paths to `ConvertedMap#putInterned`.
      The new cache is limited to 10k strings, and when more are used only
      the FIRST 10k strings will be primed into the cache, leaving the
      remainder to always hit the global String intern pool.

NOTE: by fixing this bug, we alow events to be created whose fields _CANNOT_
      be referenced with the existing FieldReference implementation.

Resolves: https://github.com/elastic/logstash/issues/13606
Resolves: https://github.com/elastic/logstash/issues/11608

* field_reference: support escape sequences

Adds a `config.field_reference.escape_style` option and a companion
command-line flag `--field-reference-escape-style` allowing a user
to opt into one of two proposed escape-sequence implementations for field
reference parsing:

 - `PERCENT`: URI-style `%`+`HH` hexadecimal encoding of UTF-8 bytes
 - `AMPERSAND`: HTML-style `&#`+`DD`+`;` encoding of decimal Unicode code-points

The default is `NONE`, which does _not_ proccess escape sequences.
With this setting a user effectively cannot reference a field whose name
contains FieldReference-reserved characters.

| ESCAPE STYLE | `[`     | `]`     |
| ------------ | ------- | ------- |
| `NONE`       | _N/A_   | _N/A_   |
| `PERCENT`    | `%5B`   | `%5D`   |
| `AMPERSAND`  | `&#91;` | `&#93;` |

* fixup: no need to double-escape HTML-ish escape sequences in docs

* Apply suggestions from code review

Co-authored-by: Karol Bucek <kares@users.noreply.github.com>

* field-reference: load escape style in runner

* docs: sentences over semiciolons

* field-reference: faster shortcut for PERCENT escape mode

* field-reference: escape mode control downcase

* field_reference: more s/experimental/technical preview/

* field_reference: still more s/experimental/technical preview/

Co-authored-by: Karol Bucek <kares@users.noreply.github.com>
2022-05-24 07:48:47 -07:00
Rob Bavey
9e2c87a1ab
Switch adoptopenjdk url to adoptium (#14098)
* Switch adoptopenjdk url to adoptium

Newer versions of the JDK are only available from api.adoptium.net, and not dual hosted on api.adoptopenjdk.net
This commit allows the use of adoptium versions of the JDK.

Relates: #14072
2022-05-24 09:33:44 -04:00
Ry Biesemeyer
e6520cfee1
deps: pin rufus-scheduler to 3.7.x (#14150)
* deps: pin rufus scheduler to 3.7.x

* duplicate add_runtime_dependency 'rufus-scheduler'

Co-authored-by: Karol Bucek <kares@users.noreply.github.com>
2022-05-24 00:50:41 -07:00
Mashhur
15dd1babf0
Simplifying HTTP basic password policy. (#14105)
* Simplifying HTTP basic password policy.
2022-05-23 21:11:10 -07:00
beirtipol
938db64636
Add value converters for java.time (#13972)
Add value converters for java.time.LocalDate, LocalDateTime and ZonedDateTime
2022-05-23 22:30:14 +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
02c2aec710
Fix debug output for bin/logstash-plugin (#14132)
When run in debug mode, #invoke was returning an instance of UI::Shell rather
than a string, causing the plugin to crash when `<<` was called on.
This commit ensures that a string is returned regardless of whether debug is set

Fixes: #14131
2022-05-20 09:13:08 -04:00
Andrea Selva
69107a5bc6
Simplifies aliass registry marking task config and move into separate class (#14138)
Introduce some default configs for Alias registry signing task, extract into separate class and cover with tests.
2022-05-20 13:59:55 +02:00
kaisecheng
da68ff3803
This commit avoids unnecessary thread sync of PQ notFull state. (#14129)
When PQ is full, workers wake up writer thread in every read.
However, without removing a fully acked page, queue is still full.
This commit changes the condition of notFull signal.
Fixed: #6801
2022-05-20 12:14:54 +01:00
kaisecheng
205cf43213
[Doc] queue.max_bytes for all queues (#14128)
* bring back the details of PQ size checking
2022-05-20 10:32:21 +01:00
Andrea Selva
2e2dcbb46a
Fixed SignAliasDefinitionsTask task to depend on input yaml registry file (#14126)
Updates the SignAliasDefinitionsTask Gradle task to express as input dependency the Aliases registry yaml file, so that when the input changes then a new signed registry is created.
2022-05-20 09:26:37 +02:00
Nicole Albee
a6e418adf7
Doc: Update settings file doc to call out queue type (#14127)
* [DOCS] Added a few missing "(`queue.type: persisted`)" to a few of the logstash.yml.
* [DOCS] Moved a few of the queue_type persisted indicators.
2022-05-19 20:36:06 -04:00
Rob Bavey
4209481cc1
Add troubleshooting information around using certain versions of the … (#14061)
* Add troubleshooting information around using certain versions of the JDK on Windows

Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2022-05-19 11:44:56 -04: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
RobertShan2000
379ebaf1bd
Update JVM document to fix issue 13561 (#14099)
Fix a contradictory statements about setting LS_JAVA_HOME with Logstash bundled with JDK.
Fix #13561
2022-05-19 10:13:37 +02: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
Ry Biesemeyer
06bca0150f
deps: pin concurrent-ruby pending removal of TimerTask (#14113) 2022-05-18 00:29:34 -07:00
Mashhur
33328955c4
[CPM] Fetch pipelines with wildcard IDs from ES and apply. (#14076)
* [Central Pipeline Management] Fetch pipelines with wildcard IDs from ES and apply. #14076

* URL encoding applied, code review feedbacks taken: unit test case for getting es version API and separate method for ES wildcard support.
2022-05-17 16:08:53 -07:00