Commit graph

109 commits

Author SHA1 Message Date
vodorok
8e00989a37
Remove unnecessary whitespace from logstash.yml (#15262) 2023-08-22 09:21:41 -07:00
Edmo Vamerlatti Costa
6463a4aab1
Add API SSL supported protocols setting (#15166)
This commit adds a new Logstash API setting to configure the SSL/TLS supported protocols (api.ssl.supported_protocols).
2023-07-14 14:21:20 +02:00
Edmo Vamerlatti Costa
e76e582086
Add missing Elasticsearch SSL settings and replace deprecated options (xpack.monitoring and xpack.management) (#15045)
This commit adds missing Elasticsearch SSL settings and replaces deprecated options being used on `xpack.monitoring.*` and `xpack.management.*` settings:

Changes:
- Updated deprecated monitoring and management Elasticsearch's SSL settings so no warnings are logged.
- Added monitoring settings support for file-based certificates and for the cipher suites: `xpack.monitoring.elasticsearch.ssl.certificate`, `xpack.monitoring.elasticsearch.ssl.key`, and `xpack.monitoring.elasticsearch.ssl.cipher_suites`.
- Added management settings support for file-based certificates and for the cipher suites: `xpack.management.elasticsearch.ssl.certificate`, `xpack.management.elasticsearch.ssl.key`, and `xpack.management.elasticsearch.ssl.cipher_suites`.
2023-05-15 11:54:38 +02:00
Andrea Selva
c0a5665f52
Fix duplicate description for storage_policy in yaml config files (#15014)
With PR #13923 was described how the DLQ storage_policy behaves. With PR #14261 was introduced a duplication of the description in logstash.yml.

This commit resolves the duplication and keeps the latest description that seems more direct expressive.
2023-04-20 16:04:36 +02:00
Andres Rodriguez
56e626afc5
Allow usage of dead_letter_queue.retain.age in pipeline settings (#14954)
* Allow usage of dead_letter_queue.retain.age in pipeline settings (Closes: 14951)
2023-03-21 09:57:59 -04:00
Edmo Vamerlatti Costa
e4dc82a9b3
Add setting to disable the GeoIP database downloader (#14823)
This commit adds a new logstash.yml setting "xpack.geoip.downloader.enabled" to disable the GeoIP databases auto-update feature. When disabled, Logstash will fall back to the CC database license indefinitely and delete any previously downloaded EULA databases.

Closes #14724
2023-01-05 15:46:35 +01:00
Karol Bucek
74e72fb9b0
Perf: use JRuby JIT defaults (improves startup) (#14284)
Removing the -Djruby.jit.threshold=0 flag, which seems to have been introduced due benchmarking.

Removing the force of AOT means a noticeably faster startup (we do not need to 'compile' every method we bump into). The JIT threshold default is 50 in JRuby 9.2/9.3, there might be other heuristics in the future to better determine hot methods.
2022-09-27 16:28:08 -04:00
Andrea Selva
be87b0b878
Implement DLQ age retention policy (#14255)
Updates DLQ writer's writeEvent method to clean the tail segments  older then the duration period. This happens only if setting dead_letter_queue.retain.age is configured.
To read the age of a segment it extract the timestamp of the last (youngest) message in the segment.

The age is defined as a number followed by one of d, h, m, s that stands for days, hours, minutes and seconds. If nothing is used then assumes seconds as default measure entity.

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2022-06-30 18:09:15 +02:00
Ry Biesemeyer
7757908c34
Add ca_trusted_fingerprint to core features (monitoring/central-management) (#14155)
* add `ca_trusted_fingerprint` to core features (monitoring/central-management)

* Rely on released ES output

* fix: ensure commented-out examples in logstash.yml are functionally correct

* add admonition for how to get a trusted CA's fingerprint
2022-06-28 17:07:59 -07:00
Mashhur
d0c9aa8f48
File system mismatch when each pipeline uses separate file system. (#14212)
* Logstash checks different file system if each pipeline has a symlink to other filesystem.

* Apply suggestions from code review

* FileAlreadyExistsException case handling when queue path is symlinked.

Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-06-16 09:22:00 -07:00
Andrea Selva
9c6e8afaca
Added description into logstash.yml for sotrage_policy, missed in #13923 (#14261)
Updates the logstash.yml with the description of dead_letter_queue.storage_policy which was missed in PR #13923

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-06-16 09:36:09 +02:00
Mashhur
15dd1babf0
Simplifying HTTP basic password policy. (#14105)
* Simplifying HTTP basic password policy.
2022-05-23 21:11:10 -07:00
Mashhur
12162cbd80
Change on_superuser to run_as_superuser to clear a confusion. (#14089)
* Change on_superuser to run_as_superuser to clear a confusion.
2022-05-17 10:54:06 -07:00
Mashhur
d8e08e9f20
Add complex password policy on basic auth (#14045)
* Apply complex password policy on HTTP basic auth.
2022-05-03 09:57:46 -07:00
Mashhur
25796737c3
Prevent Logstash from running as root. (#14046)
* Prevent Logstash from running as root.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
2022-05-02 08:53:35 -07:00
Andrea Selva
c1fe7095c3
Implements DLQ storage policy (#13923)
Exposes dead_letter_queue.storage_policy configuration setting to explicitly enable the drop_older behavior in DLQs.

Moving from a drop_newer to a drop_older behavior has impact both on the writer side and to the reader side.
The implementation leverage the fact that a complete DLQ segment can be removed to free up space; on the writer side when the dead_letter_queue.max_bytes limit is reached it has to remove old segments.

On the reader side, the consuming has to be adapted to don't expect a continuous flow of segments, it could face an hole due to removal of tail segments.

Co-authored-by: João Duarte <jsvd@users.noreply.github.com>
Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2022-04-28 09:16:03 +02:00
Rob Bavey
b4c54ab681
[Java17] Add --add-export settings to restore JDK17 compatibility (#13825)
* [Java17] Add `--add-export` settings to restore JDK17 compatibility

After #13700 updated google-java-format dependency, it is now required to add a number
of `--add-export` flags in order to run on JDK17. This commit adds these flags to the
jvm options for a running logstash, and to the tests running on gradle to enable tests
to still work

* Move mandatory JVM options out of `jvm.options` and into JvmOptionsParser

Certain values for the JVM are mandatory for Logstash to function correctly. Rather than
leave them in config/jvm.options where they can be updated, and can cause upgrade issues
for users when we add new mandatory options, move them into code where they cannot be
changed
2022-03-24 16:59:15 -04:00
Karen Metts
68bacedf49
Doc: Improve formatting and readability for pipeline ordering (#13084)
Add pipelines.ordered entry to pipelines.yml

Co-authored-by: Rob Bavey <rob.bavey@elastic.co>
2022-03-04 18:18:52 -05:00
Ry Biesemeyer
c3e498a24b
ECS on by default for Logstash 8, again (#13391)
* ecs: report pipeline's ECS-compatibility with INFO at startup

Because the pipeline-level setting `pipeline.ecs_compatibility` affects the
default behaviour of nearly every plugin in the pipeline, an INFO-level log
message will provide useful hints, especially to our users who upgrade to
Logstash 8 without first reading the breaking changes docs.

For example, when we have two pipelines `old` and `new` whose `pipeline.ecs_compatibility` is `disabled` and `v8` respectively, we would get the following log messages:

> ~~~
> [2021-11-04T18:43:21,810][INFO ][logstash.javapipeline    ] Pipeline `old` is configured with `pipeline.ecs_compatibility: disabled` setting. All plugins in this pipeline will default to `ecs_compatibility => disabled` unless explicitly configured otherwise.
> [2021-11-04T18:43:21,817][INFO ][logstash.javapipeline    ] Pipeline `new` is configured with `pipeline.ecs_compatibility: v8` setting. All plugins in this pipeline will default to `ecs_compatibility => v8` unless explicitly configured otherwise.
> ~~~

* ecs: make v8 the default for 8.0

* ecs: `pipeline.ecs_compatibility` defaults to `v8`

Related: elastic/logstash#11623

* doc: temporarily remove deep link from breaking changes doc to fix build
2021-11-17 13:17:23 -08:00
João Duarte
dd2245c447
only use --add-opens flags on java 11+ (#13360) 2021-10-26 15:50:40 +01:00
Rob Bavey
4188bacb69
Update jvm.options to remove JDK 8 only settings (#13349)
This includes removing invalid GC logging options, instead using the same parameters
as Elasticsearch.
This also sets the `add-opens` to remove warnings for Java 11 and 17
2021-10-25 13:20:27 -04:00
Ry Biesemeyer
15930ccd3e
Secure API (#13308)
* 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:20 -07:00
Andrea Selva
7395641a43
Fixes to build and run Logstah on JDK 17 (#13306)
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 11:13:26 +02:00
kaisecheng
8c83282bae
geoip integrate air-gapped bootstrap script (#13104)
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-27 18:56:22 +02:00
Ry Biesemeyer
68f3cf3d90
ecs_compatibility: revert breaking change; keep disabled as default for 8.0.0 (#13080)
As we close in on the availability of 8.0.0 alphas, we are reassessing which
breaking changes are _necessary_, and which are merely _desired_. And while
we would love to be in a world where ECS was on by default, and have put
substantial effort into designing an upgrade path that would be as simple as
possible, we have determined that the time may not be right to change the
default value out of under our users.

This change restores the default value for `pipeline.ecs_compatibility` to
`disabled`, ensuring pipelines will continue running in Logstash 8 as they have
in Logstash 7 without modification. We will still encourage our users to be
explicit about which behaviour they desire, and will revisit making ECS on by
default at a later date.
2021-07-20 14:45:36 -07:00
Ry Biesemeyer
1a4be956c4
ecs: on-by-default plus docs (#12830)
* noop: avoid declaring default value in config file

* docs: ecs compatibility from 7.x perspective

Co-authored-by: Karen Metts <karen.metts@elastic.co>

* ecs: on by default

We know that ECS version 8 will release along-side Logstash 8.0, but its scope
is still coming into focus. In this changeset, we change the default value
of `pipeline.ecs_compatibility` from `disabled` to `v1`, which is a
significantly closer approximation to what will eventually ship in Logstash
8.0.0.

* docs: ecs from 8.x perspective

Co-authored-by: Karen Metts <karen.metts@elastic.co>

Co-authored-by: Karen Metts <karen.metts@elastic.co>
2021-06-21 11:00:08 -07:00
Andrea Selva
a0774c4e76
Explicitate the type of log format in appender's names (#12964)
Remove an useful dynamic creation of appender's log file which leverages the `log.format` property 
also when it's explicit by the appender itself.

Log4j configuration leverages the placeholder `${sys:ls.log.format}` to compose the name of the log file.
This generates some not evident conflicts in log4j internals, these conflicts became evident when enabling the `pipeline.separate_logs` feature is enabled and the log4j appender definitions contains both json and plain format.
The problem is that under those circumstances the rollover of the log file doesn't happen.

This commit also add a test against the production log4j configuration, to avoid future regressions.
2021-06-15 11:25:08 +02:00
kaisecheng
4f6d81ded7
remove CMS from jvm options in java 14 (#12638) 2021-02-03 12:16:28 +01:00
andsel
7ba8c75458 Introduction of conditional in jvm.options file (#12530)
- moved parsing of jvm.options file into Java code
- chnaged the parsing code to consider conditional notation to bind the applicability of certain JVM flags to specific JVM versions
- changed the launch scripts (.sh and .bat) to use the options string composition
- binded CMS flags to JVM specifications 8-14
2021-01-25 05:16:18 -08:00
andsel
99679870c6 Implements scripted log4j filters and appenders to Java, avoid usage of deprecated Javascript Nashorn (#12512)
- replaces all scripted filters with custom Java implementation
- implemented routing appender per pipeline in Java
- adapted log4j configuration shipped with Logstash
- exit the Logstash process if it detects an scripted log4j configuration
2021-01-25 02:25:09 -08:00
Rob Bavey
06af15030a
Write DLQ entries to temp file first (#12304)
* Write DLQ entries to temp file first

This commit changes the DLQ writer to write to a temporary file
 which will be renamed on "completion", to avoid the possibility
 of the DLQ reader reading an incomplete DLQ segment. The temp file
 will be renamed and made available, either when the capacity of this
 segment is reached, or if a configurable 'flush interval' has elapsed
 since the last event reached the dead letter queue.

This commit fixes #8022, #10275, #10967
This commit replaces #11127
2020-10-07 11:46:17 -04:00
Andres Rodriguez
0d82bc064c
Docker: Expose xpack.management.elasticsearch.proxy (#12201)
Expose the proxy xpack management proxy setting in docker (xpack.management.elasticsearch.proxy).
Also surface the same proxy setting in the sample config.
2020-08-25 16:07:29 -04:00
Karol Bucek
5eb25dc40b Feat: ship log4j2 commons-logging bridge with LS
Having the jar around would allow us to fine tune logging for libraries
such as manticore's http-client (4.5) using LS's `log4j2.properties`
e.g.

```
logger.apache_http_headers.name = org.apache.http.headers
logger.apache_http_headers.level = DEBUG
```
... to log http headers for each request

Co-authored-by: Ry Biesemeyer <yaauie@users.noreply.github.com>
2020-06-23 02:39:29 -07:00
Colin Surprenant
0fe5305e79 add commented out options for api_key in logstash.yml 2020-06-10 13:49:42 -07:00
Joao Duarte
a7ae0d55e6 update log4j script routes definition
fixes the change introduced with https://issues.apache.org/jira/browse/LOG4J2-2647
2020-06-09 06:26:31 -07:00
João Duarte
0d127737aa
reinstate x-pack.monitoring settings in logstash.yml (#11822) 2020-04-22 15:28:47 +01:00
Ry Biesemeyer
de5888ba18 API: avoid starting webserver when http.enabled=false
In some workflows such as simple file manipulation, starting a webserver is
unnecessary overhead, and we should be able to avoid it.

Here we introduce a new parameter `http.enabled`, which defaults to `true` to
maintain the existing functionality.

Resolves: elastic/logstash#9408
Closes: elastic/logstash#11525

Co-authored-by: Benoit Dupont <benoit.dupont@gmail.com>

Fixes #11533
2020-04-21 20:08:46 +00:00
Karen Metts
13ae7bb03a
[Doc]Note that unit qualifier is required for config.reload.interval (#11771)
* Note that unit qualifier is required for config.reload.interval

* Update description in logstash.yml
2020-04-13 14:48:03 -04:00
andsel
3695580b92 Adaptations to internal collector to send data directly to monitoring cluster Close 11573
Fixes #11541
2020-02-28 14:26:19 +00:00
Colin Surprenant
0bc9fa5665
add support for pipeline.ordered setting for java execution (#11524)
reuse rubyArray for single element batches

rename preserveBatchOrder to preserveEventOrder

allow boolean and string values for the pipeline.ordered setting, reorg validation

update docs

yml typo

Update docs/static/running-logstash-command-line.asciidoc

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

Update docs/static/running-logstash-command-line.asciidoc

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

java execution specs and spec support

docs corrections per review

typo

close not shutdown

Ruby pipeline spec
2020-01-29 14:01:38 -05:00
andsel
6eb25173e0 Added plugin.id to fish tag log lines related to plugins
Fixes #11078
2020-01-23 15:33:31 +00:00
Karol Bucek
d8398351a2
Feat: x-pack cloud id/auth for monitoring/management (#11496)
resolves #11488
2020-01-14 22:06:50 +01:00
andsel
f554930e81 Introduced DeprecationLogger for use in core code and exposed to Java and Ruby plugins. Closes 11049
Fixes #11260
2019-11-14 10:49:27 +00:00
andsel
4621a0a798 Fix to avoid Nashorn error regarding the unknown flag --no-deprecation-warning for JDK < 11. closes 11221
Fixes #11225
2019-10-17 10:46:23 +00:00
João Duarte
ec16c49741 remove 10k character truncation from log4j2.properties
Quite often we see log entries that are truncated by this limit since java stack traces can be very verbose.

This prevents us from seeing the real issue and require us to ask for users to remove the limitation and trigger the issue again so we can see the full problem.

This commit removes this truncation.

Fixes #11206
2019-10-10 10:28:24 +00:00
andsel
e58a6e01ce Added LS configuration variable 'pipeline.separate_logs' to separate logs per pipelines - use log4j RoutingAppender - avoid output to main log files when log per pipeline is enabled - closes 10427
Fixes #11108
2019-10-08 14:07:17 +00:00
andsel
cda592f659 Add pipeline.id to log lines
fixes #8290, #10521
2019-08-28 17:57:28 +02:00
Colin Surprenant
696323f26a make sure joni regexp interruptability is enabled
Fixes #10978
2019-07-22 16:22:32 +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
Ry Biesemeyer
583ec6b625
Java 11 support (#10279)
* bump jruby to 9.2

* don't rely on logstash-base docker image

* work around webmock ruby 2.5 support

* ensure data folder exists in docker

* change fixnum and bignum to integer

* FileUtils.rmdir to rm_rf

this is because from 2.3 to 2.5 FileUtils.rmdir will throw an exception
if the directory isn't empty. On 2.3 the operation will just not delete
the directory silently.

* bump jruby to 9.2.5.0 and fix test

* make rake default task since prepare pack needs it

* Resolve compiler warnings (#10247)

There are 3 types of compiler warnings that are either resolved or suppressed:

1. Rawtypes: In JRuby 9.2, `RubyArray` is a generic, so references throughout
   our codebase to the now "raw" type trigger warnings. In most cases we cannot
   actually resolve the issue, since the JRuby-provided methods for creating
   `RubyArray`s still return the raw type, so these have been suppressed.

2. Deprecations:
   - `RubyString#intern19()` -> `RubyString#intern()`
   - `RubyString#downcase19(ThreadContext)` -> `RubyString#downcase(ThreadContext)`
   - `NativeException`: remove import & reference directly; suppress usage
     warnings
   - `RaiseException()`: migrate to equivalent non-deprecated methods wherever
     possible; in some cases where we are using this in conjunction with the
     also-deprecated `NativeException` to preserve java stacktraces, there
     seems to be no non-deprecated path forward, so these cases have been
     suppressed.

3. Redundant Casts
   - Resolved

* JRuby 9.2 bundler shenanigans (#10266)

* Revert "Revert "remove forced dependency on old bundler (#9395)""

This reverts commit bef984143d.

* plugin management: update internal bundler to 1.17.x APIs

* deps: update dev dependency webmock to version compatible with JRuby 9.2

* spec: update Pack fixture to include manticore version that doesn't conflict

* build: update gradle to version that has Java 11 support

* java11: resolve or suppress deprecation warnings

* Remove superfluous flag opting into ParNew GC implementation

When opting into CMS garbage collector with `XX:+UseConcMarkSweepGC`, the
young generation collector ParNew has been the default since Java 8, making
the `XX:+UseParNew` flag redundant; the flag was removed in Java 9, and
should no longer be specified to work with modern Javas.

https://bugs.openjdk.java.net/browse/JDK-8006478
https://openjdk.java.net/jeps/214

* spec: set thread name to example description for easier debugging

* spec: prevent errors in testing specs by checking against skip list before using

* no-op: remove use of `HashMap#computeIfAbsent` on single-threaded code

> This method will, on a best-effort basis, throw a `ConcurrentModificationException`
> if it is detected that the mapping function modifies this map during computation.
>
> -- https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html#computeIfAbsent(K,java.util.function.Function)

* qa: by default, run integration against Elastic Stack 6.5.x

To support development on Logstash on top of Java 11, default to testing
against an Elastic Stack that is capable of running on Java 11.

* qa: ignore deprecation warnings when comparing offline pack output

* qa: add Java 9+ support to ChildProcess dev dependency

this can safely be removed when the childprocess gem supports Java9+
https://github.com/enkessler/childprocess/pull/141

* qa: allow connections to localhost in webmock

* bump jrjackson version

* fix filebeat integration tests

* spec: ensure license compliance spec runs first

The license compliance spec that validates the licenses of bundled
plugins appears to not be compatible with the hooks that we inject
into bundler for plugin management, and will fail in obscure ways
when run after those hooks have been added. Since those hooks are
not necessary for validating licenses, the easiest solution was to
ensure that those specs run first, before the VM has been poluted.

Since the gradle/junit/rspec bridge that is currently in place
runs all specs in the same JVM, we also need to make sure that the
rspec "world" is reset before a run, to ensure that it doesn't
retain spec definitions from previous runs.

Also updates the rake invocation, although I'm not sure it is used
any more.
2019-02-04 16:36:11 -08:00