Commit graph

226 commits

Author SHA1 Message Date
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
aristosvo
5ef181bfae Update logstash.bat to enable CLASSPATH with spaces
```Error: Could not find or load main class Files\Java\jdk1.8.0_172 org.logstash.Logstash -e input```

I had C:\Program Files\Java\jdk1.8.0_172 as part of my classpath, which caused this error. After adding " arround %CLASSPATH% it worked fine for me

Fixes #9898
2018-09-06 18:27:14 +00:00
Dan Hermann
9b73071e67 instructions on how to run tool, remove unused readlink call in script
Fixes #9931
2018-08-27 21:44:47 +00:00
George Xie
d1cafc393b system-install pass pleaserun exit code to outside
system-install should fail hard if pleaserun failed.
related with #9403

Fixes #9841
2018-07-23 17:21:24 +00:00
Colin Surprenant
1124d799a8 fix broken classpath when whitespaces are in the path #9832
reverse classpath jars order and remove trailing colon
2018-07-16 16:43:25 -04:00
Armin
6d0230aa4f PQ Repair Utility
Fixes #9710
2018-06-12 08:28:06 +00:00
Armin
3e14bc2741 JAVAFICATION: Javafy PqCheck Ruby Script
Fixes #9533
2018-05-07 13:13:32 +00:00
Dan Hermann
0e2186c36f remove unnecessary license mapping and shell function
Fixes #9331
2018-05-02 15:35:42 +00:00
Dan Hermann
48594baf2b Add license reporting task
Fixes #9331
2018-05-02 15:35:42 +00:00
Simon Lundström
c53c88819c Respect JAVACMD and update Drip docs to reality
Fixes #9373
2018-04-27 17:30:33 +00:00
Paul Pawlik
30401e3999 make -V/--version fast on Windows (#8508) 2018-02-21 11:16:00 -05:00
Liu Chong
9807016274 Replace command 'which' with 'command -v' for compatibility
I think we should not check if a command exists which another command, in here 'which'.
Instead we should use a build-in method, in order that script still works in some environments
that, such as a basic docker image, do not have a "which" command.

Fixes #8880
2018-02-07 17:43:20 +00:00
Colin Surprenant
2996062232 fix integration tests build 2018-01-24 10:26:56 -05:00
Jake Landis
058c9a6c47 Secret Store: Ability to set and use secret data from an encrypted data store.
Fixes #8657

Part 1: API and JavaKeyStore implementation (#8657)

Introduces the API to read/write/delete sensitive data from a secure store and includes a Java KeyStore implementation. Note - this commit does NOT integrate with the Logstash configuration or settings.

Part 2: Secret Store: SecretStoreFactory, SecureConfig, Obfuscation and X-JVM support (#8659)

*  Secret Store: SecretStoreFactory, SecureConfig, Obfuscation and X-JVM support

* Introduce a SecretStoreFactory to allow runtime definition of SecretStore implementation.
* Introduce a SecureConfig to allow simple configuration of different SecretStore implementaiton.
* Introduce random default password plus obfuscation. Best attempt at security through obscurity.
* Corrections / better support for x-JVM modification.

Part 3: Secret Store: SecretStore, SecretStoreFactory, JavaKeystore - refacactor (#8745)

* Adds more CRUD like operations for SecretStore API
* SecretStoreFactory Mirror API's CRUD operations
* Adds 'exists' to API to allow command line warning 'Overwrite ?'
* Minor readabiliy

Part 4: Integrate secret store with Logstash core (#8905)

This change introduces the command line tooling and hooks needed to allow Logstash to use the secret store. This change hooks into the same logic that the does the environment variable substitution. The commnad line mirrors the Elasticsearch command line, and is implemented primarily in Java.

Part 5: Hardening and test fixes (this PR)

Fixes #8935
2018-01-13 01:22:53 +00:00
Colin Surprenant
67c12393ac correctly handle paths with spaces 2018-01-11 13:28:15 -05:00
Armin
543b7221bd JAVA EntryPoint
* Created `org.logstash.Logstash` as entrypoint
* Safely handle `Ruby` runtime (which sadly is still a singleton, moving away from that will require a few iterations on top of this)
* Adjusted `bat` and `sh` entry point wrappers
* Verified manually that performance is unchanged (i.e. all Java opts are still loaded properly)
* Flattened `.jar` path to make it a little less bothersome to build the `-cp` string
* Retained ability to load jars from Ruby via the global `$LS_JARS_LOADED` variable hack, to keep plugin specs that load LS as a `.gem` functional (like e.g. the ITs in LS itself)
* No need for the gem jars magic anymore, the downloading and moving into place of jars is now all handled by Gradle

Fixes #8161
2018-01-03 19:13:28 +00:00
Armin
cd6d9c3a51 MINOR: Prevent enviornment GEM_DIR and GEM_PATH from leaking into build
Fixes #8896
2017-12-29 18:21:38 +00:00
Colin Surprenant
c091612877 added new PQ checking tool bin/pqcheck
rework output format

rework output format
2017-12-22 16:44:57 -05:00
Jordan Sissel
5786dcd47a Add tool to generate dependency details in csv
Fixes #8725

Rough goal is to present license information for all dependencies

Fixes #8881
2017-12-22 16:54:29 +00:00
Armin
2f76534958 MINOR: Remove duplication and fix docs in bundler shim
Fixes #8585
2017-11-06 14:52:40 +00:00
Colin Surprenant
6e5b2b2cff bubble up failed exit status 2017-10-12 11:21:13 -04:00
Guy Boertje
9b09d4c899 bump JrJackson/Jackson versions, source all version refs from versions.yml
final (I hope) fixes for consolidated versioning.

After testing with rake artifact:zip, need to try both files.
Add desc to rake test:install-* tasks, tired of
  not seeing them in rake -vT

changes requested via review

Fixes #8373
2017-09-26 15:29:58 +00:00
Colin Surprenant
83fde50920 pick jvm.options for rspec.bat 2017-09-21 15:45:13 -04:00
Colin Surprenant
0e3b9a3eb1 refactor linux launch scripts per #8261
remove dripmain.rb
2017-09-19 16:40:21 -04:00
Colin Surprenant
83f6c9fa04 update plugin manager script for setup.bat changes 2017-09-15 17:57:46 -04:00
Colin Surprenant
e9a8812317 reword windows launch script
fixes

fix jvm.options parsing

windows compatible URI
2017-09-14 16:24:34 -04:00
Armin
d1eecfc208 Benchmark: added run script
Fixes #7875
2017-08-02 15:16:16 +00:00
Colin Surprenant
f3f24dc706 reference correct class path 2017-07-18 16:21:09 -04:00
Pier-Hugues Pellerin
76286b4f0e use jruby 9.1.9.0
Work done by @guyboertje and @ph

Since JRuby 1.7.25 is now EOL we are migrating Logstash to use JRuby 9k and JDK8 only,
Not much needed updating to make this work, its was mostly a drop in replacement from the previous version.

The major point was the change in the implementation of Time in JRuby, JRuby now use `java.time`
instead of joda time, this allow JRuby to have nanoseconds precision on time object.
2017-06-12 12:35:10 -04:00
Armin
12264efad2 #7329 invoker script for convert jar
Fixes #7335
2017-06-07 07:17:53 +00:00
Wainer dos Santos Moschetta
4163af5bea Add test case for FileLockFactory
This change introduce a test for cross-process/jvm file locking
using the FileLockFactory class. It uses a client program that
will lock a file aftwards the test case proceed.

Fixes #6610

Fixes #7117
2017-05-24 02:20:36 +00:00
Bernd
ec87eb7642 removed unreachable code (#5215) 2017-05-19 11:32:24 -07:00
Wainer dos Santos Moschetta
d4e7705b14 Quote shell script variables handling paths.
Some variables that hold path in Linux shell scripts
are not properly quoted, thus undefined behaviors may
show up (e.g. a link path with space).

This change enclose variables with quotes in bin/logstash,
bin/logstash.lib.sh and, bin/system-install scripts.

Fixes #6596

Fixes #6877
2017-04-04 15:00:48 -04:00
manni19682
933c936917 Search java executable in %PATH%
Fixes #6860
2017-03-31 14:00:41 -04:00
Josh Soref
a06dc211ff Spelling fixes (#6806)
Spelling fixes across the board.
2017-03-29 19:33:26 -07:00
Aaron Mildenstein
0d90e12c54 Update pleaserun and system-install
This will now put ENV variables from the `startup.options` file into `/etc/default/logstash` or `/etc/sysconfig/logstash` (or whatever service name you chose), and use the updated pleaserun to ensure these are honored at start time for whichever init system you use (systemd, upstart, SysV).

fixes #6482

Fixes #6660
2017-02-09 12:12:33 -05:00
Colin Surprenant
d79e3730fe exclusive file locking class and tests
use new bin/ruby and bundler without :development

refactor to DRY and use expected exception

added original Apache 2.0 license and some cosmetics

exclude bin/lock from packaging

rename variables
2017-01-31 13:47:07 -05:00
Colin Surprenant
ca9ff9172d add bin/ruby command to launch ruby scripts using the logstash launcher
use bin/ruby instead of hardcoded vendorized jruby

without :development

remove symlink check per PR discussiom, will re-introduce in a followup PR
2017-01-30 17:05:23 -05:00
Aaron Mildenstein
35999aeeab Change system-install to allow manual selection
Now you can specify 3 arguments, each dependent on the previous:

1. full path to the `startup.options` file
2. the startup variant (sysv, upstart, systemd)
3. the version of the startup variant (usually unnecessary, can safely be left blank)

Present behavior is preserved.  If `system-install` is called with no arguments, it autodetects and installs the detected variant.

Fixes #6338
2016-12-09 12:57:16 -05:00
Aaron Mildenstein
60b6a9f72e Have logstash.lib.sh find jvm.options
This will work if `--path.settings` is properly used on the command line

Remove unused count variable

It isn't strictly necessary

Add double-quotes around $@

This should protect against strange spaces

fixes #6379

Fixes #6382
2016-12-09 12:19:22 -05:00
Bartłomiej Palmowski
d5d556989d Don't pass jruby opts explicitly
they are already passed via JAVA_OPTS environment variable.

Fixes #5830
2016-12-06 13:24:59 -05:00
Gérald QUINTANA
2bb69743e6 Fix Heap Dump Path on Windows
Fixes #6336
2016-12-01 23:20:38 -05:00
Shinjifox
8c9b874c98 Fixed typo for logstash cli help
The original shell script throws a error when calling it with "bin/logstash help"
# ./logstash help
ERROR: Unknown command 'help'

See: 'bin/logstash --help'

Fixes #6303
2016-11-29 05:46:42 -05:00
Colin Surprenant
f636a751f8 add support for queue.checkpoint.{acks|writes} settings
add queue.max_acked_checkpoint and queue.checkpoint_rate settings

now using checkpoint.max_acks, checkpoint.max_writes and checkpoint.max_interval

rename options

wip rework checkpointing

refactored full acked pages handling on acking and recovery

correclty close queue

proper queue open/recovery

checkpoint dump utility

checkpoint on writes

removed debug code and added missing newline

added better comment on contiguous checkpoints

fix spec for new pipeline setting
2016-11-22 14:48:58 -05:00
汪啸
1f1bbb1f89 fix wrong logic when no JAVA_OPTS set
Fixes #6034
2016-10-14 17:55:43 -04:00
Joao Duarte
72b277404b make -V/--version fast on *nix 2016-06-21 14:30:15 +01:00
Joao Duarte
bb0694d69a Revert "make -V/--version fast on *nix"
This reverts commit 562754b11a.
2016-06-17 10:00:57 +01:00
Joao Duarte
562754b11a make -V/--version fast on *nix 2016-06-16 12:46:23 +01:00
Aaron Mildenstein
4baf29dc5f Add SINCEDB_DIR env var to logstash.lib.sh
This is to fix the file input

Fixes #5385
2016-05-27 22:08:58 +00:00
Aaron Mildenstein
e40ecbb6b8 Update existing packaging to use /usr/lib/logstash
Update after-install scripts

Use /usr/lib/logstash instead of /opt/logstash

More revisions.

Using `/usr/share/logstash` instead of `/usr/lib/logstash`

Track these new files

More work in progress.

Proper arg parsing obtained

WIP: Use jvm.options like ES

Remove facter dependency

Due to an update from @jordansissel on pleaserun, facter is no longer necessary

Revert Gemfile to proper version

Latest work in progress.

I added a simple test to logstash.lib.sh to catch empty strings in java options.

Added `startup.options`, and touched up `jvm.options`

Edited the package scripts to make things play nice with new paths.

Tweaked `system-install` to allow users to provide their own `startup.options` file.

Patch up merge failure

Changes to work with the new logstash.yml

Add fpm dependency (build fails without it)

Fix missing gems in Gemfile

Don't know how these got lost

Use /etc/logstash for configuration in packages

Update the instructions/documentation for...

...startup.options

Merging proposed changes

Remove mustache and clamp

They're covered by pleaserun anyway

Prune config dir from /usr/share/logstash...

...but only when using RPM/DEB packages

Fixes #5341
2016-05-25 17:25:26 +00:00