Commit graph

89 commits

Author SHA1 Message Date
Rob Bavey
8b2f41fc83
Add jdk.io.File.enableADS=true to JVM options (#14086)
OpenJDK versions 11.0.15+10, 17.0.3+7 introduced new functionality to allow Java to enable
strict path checking. This included disallowing the use of : in any place other than directly
after the drive letter. Unfortunately, this check had the side effect of breaking compatibility
with special device paths, such as NUL:, which in turn, prevents Logstash from starting.
This feature was gated by the use of the jdk.io.File.enableADS property with a value of true
disabling the check.

This property was introduced with the default value of false, which prevents logstash
from starting in a Windows environment. While the next release is anticipated to set this
value to true, this commit explicitly sets that value to enable Logstash to be able
to start correctly.

Relates: #14066
2022-05-10 12:38:15 -04:00
Ry Biesemeyer
abadc329e1
ecs: docs and comments syncing for 7.last (#13626) 2022-01-18 16:35:07 -08: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
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
Ry Biesemeyer
873e2c7396
Backport PR #12830 to 7.x: ecs-compatibility docs (#13016)
* noop: avoid declaring default value in config file

(cherry picked from commit f8fe4b6907)

* docs: ecs compatibility from 7.x perspective

Co-authored-by: Karen Metts <karen.metts@elastic.co>
(cherry picked from commit 69702ca8f8)

* ecs docs: pr feedback a11y link text

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

Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com>
2021-06-22 20:02:11 -07:00
Andrea Selva
138b60c839
Explicitate the type of log format in appender's names (#12964) (#12997)
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.

(cherry picked from commit a0774c4e76)
2021-06-17 14:21:24 +02:00
kaisecheng
cb35193f7c
remove CMS from jvm options in java 14 (#12638) (#12639) 2021-02-03 13:08:22 +01:00
andsel
2e4845df36 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 06:50:13 -08:00
andsel
b0c81338f3 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
- print a warn message if it detects an scripted log4j configuration and continue the execution (#12591)
2021-01-25 05:46:27 -08:00
Rob Bavey
708c156c1b
[7x backport] Write DLQ entries to temp file first (#12304) (#12318)
Clean backport of #12304

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 14:37:49 -04:00
Andres Rodriguez
a755eb5470 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 13:18:01 -07:00
Karol Bucek
35d2b391aa 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 09:39:28 +00:00
Colin Surprenant
58b6e4d1c6 add commented out options for api_key in logstash.yml 2020-06-10 20:49:41 +00:00
Joao Duarte
e5f1e613ef update log4j script routes definition
fixes the change introduced with https://issues.apache.org/jira/browse/LOG4J2-2647
2020-06-09 13:26:30 +00:00
Joao Duarte
c73544f1ed reinstate x-pack.monitoring settings in logstash.yml 2020-04-23 09:38:48 +01:00
Ry Biesemeyer
252b711184 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
73a8808b19 Update description in logstash.yml
Fixes #11771
2020-04-13 18:44:59 +00: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
Colin Surprenant
6a8bebffe6
add support for pipeline.ordered setting for java execution (#11552)
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:05:47 -05:00
andsel
7a22220467 Added plugin.id to fish tag log lines related to plugins
Fixes #11078
2020-01-23 15:33:31 +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
andsel
9b308ae673 Introduced DeprecationLogger for use in core code and exposed to Java and Ruby plugins. Closes 11049
Fixes #11260
2019-11-14 10:49:28 +00:00
andsel
391169b3d7 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
15f0de3487 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
fc9c0e0ca2 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:18 +00:00
andsel
056c3e3bb8 Add pipeline.id to log lines fixes #8290, #10521
Fixes #11075
2019-08-29 10:36:05 +00:00
Colin Surprenant
524dd45202 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
João Duarte
25e773556c
remove pipeline output workers setting (#10358) 2019-01-30 10:09:15 +00:00
João Duarte
fe7607abd4
only start monitoring pipeline after valid license (#10106)
Avoid unecessary logging errors and resource usage by only starting
the monitoring pipeline if we can validate the license.
2018-11-07 17:28:48 +00:00
Guy Boertje
3fdee027d9
Add SC and EB input TLS support for the Logstash ArcSight module (#10056)
* Add SC and EB input TLS support for the Logstash ArcSight module
I added the ssl for the smart connector (tcp) and ssl and sasl for the
event broker.
Needs verification on a current stack.

* So this is the actual extent of changes (I thought it was to simple)
Fixed the docs omission
Fixed the load path issue
Fixed the ERB binding context problem
Added some basic happy path tests

* remove module settings in logstash.yml

* Overwrite my logstash.yml with the content on master

* Add comments to yaml fixtures
2018-10-23 09:12:12 +01:00
Joao Duarte
78bc47d1c9 support ssl verification mode in monitoring and management
Fixes #9866
2018-08-31 08:01:27 +00:00
Josh Soref
c6cd247ec3 Multiple spelling corrections (#9782)
* spelling: actually
* spelling: already
* spelling: concurrency
* spelling: constructor
* spelling: destinations
* spelling: different
* spelling: elasticsearch
* spelling: encoding
* spelling: error
* spelling: explicitly
* spelling: failings
* spelling: falsey
* spelling: guarantees
* spelling: having
* spelling: implementation
* spelling: logstash
* spelling: module
* spelling: multiple
* spelling: omitted
* spelling: overridden
* spelling: pipeline
* spelling: raspberry
* spelling: receive
* spelling: recommended
* spelling: registered
* spelling: registering
* spelling: shutdown
* spelling: signal
* spelling: specified
* spelling: successful
* spelling: successfully
* spelling: valuefied
* spelling: vector
2018-07-04 10:41:10 +01:00
Tudor Golubenco
500271be39 Add sample configuration file
This adds a simple Logstash config sample that works as a standard
Beats -> Logstash -> Elasticsearch starting point.

It's being deployed in packages, typically under /etc/logstash/logstash-sample.conf

This also adds a Dockerfile that can be used to build the artifacts.

Fixes #9588
2018-05-17 19:58:35 +00:00
Jenkins CI
93cad10da1 Migrate x-pack-logstash source to logstash 2018-04-24 10:46:15 -05:00
Dan Hermann
e25aa0b845 Change the default LS_SETTINGS_DIR to /etc/logstash for service installations
Fixes #9304
2018-03-30 19:57:30 +00:00
Armin
53b9b7dbf9 #9292: Fix nested conditionals compiling incorrectly
Fixes #9294
2018-03-27 18:58:46 +00:00
Armin
8ee9a990cc PERFORMANCE: Avoid redundant dataset clear calls
Fixes #9294
2018-03-27 18:58:46 +00:00
DeDe Morton
93af85edb3 Remove pipeline.output.workers from logstash.yml
Fixes #8908
2018-01-04 21:02:02 +00:00
Shaunak Kashyap
a3f6da3c3a Allow users to specify --pipeline.id from the CLI
This will allow users to override the pipeline id from the default, "main", to something else while running pipelines via either the -e or -f options.

Fixes #8868
2017-12-20 20:17:36 +00:00
Dan Hermann
1ea1d1982d Add default log retention settings
Relates to #7842

Fixes #8815
2017-12-08 22:55:33 +00:00
Dan Hermann
6c84096a03 retain the 'log' extension
Fixes #8800
2017-12-07 17:18:55 +00:00
Dan Hermann
f1da660c1b Adds size cap for each individual log file. Compresses log files on rollover.
Fixes #7482.

Fixes #8800
2017-12-07 17:18:54 +00:00
Colin Surprenant
40827a53eb change batch delay to 50ms and page size to 64mb
a 50ms delay helps creating more full batches without practical added latency see #8707
a 64mb page helps PQ perfmance related to a large page size see #8702 #8707
2017-12-05 13:51:54 -05:00
Armin
97f1c49619 #8688 enable explicit System gc calls again to improve GC of DirectByteBuffer
Fixes #8776
2017-11-30 19:59:49 +00:00
Jake Landis
70dd05d88c Revert "Add jvm option ExitOnOutOfMemoryError"
This reverts commit a14fbfc3e2.

Fixes #8268
2017-09-15 13:55:02 +00:00
liketic
a14fbfc3e2 Add jvm option ExitOnOutOfMemoryError
Fixes #8138
2017-09-05 18:56:47 +00:00
Rob Bavey
b1b3a117a6 Add multi-pipeline test
Needs DRY-ing up before commit, but tests should be valid

Fixes #8026
2017-09-01 19:43:45 +00:00