Commit graph

577 commits

Author SHA1 Message Date
Colin Surprenant
974da8c4bb use 2048 bits key
Fixes #11115
2019-09-03 21:03:32 +00:00
João Duarte
12b0987ecc
avoid variable collision in pipeline stats api (#11059) 2019-08-20 15:47:52 +01:00
João Duarte
e44ec7ad41
update jruby to 9.2.8.0 (#11041) 2019-08-13 07:45:42 +01:00
Mike Place
f5f2173c6a
Enhanced API testing (#10972)
* Starting to audit tests

* Additional field checking in stats

* Add epehemeral id

* More tests

* Test new structure of pipeline report

* Add default_metadata testing

* Add node command tests

* add jvm

* test no mutate

* Add check for graph flag

* Break apart test per review suggestion

* Remove test that doesn't test much
2019-08-12 12:05:28 +00:00
Dan Hermann
728eff24f1 simplify unit test
Fixes #10872
2019-06-29 17:27:23 +00:00
Dan Hermann
1b16eca32a Fix pipeline shutdown ordering
Fixes #10872
2019-06-29 17:27:22 +00:00
Joao Duarte
7468ed058f avoid clashes between Environment class methods
Fixes #10860
2019-06-14 17:44:38 +00:00
Dan Hermann
2f5aff2362 Merge config values in LIR
Fixes #10832
2019-05-30 12:59:09 +00:00
Dan Hermann
fd74ce0156 LIR support for octal literals in pipeline definitions
Fixes #10828
2019-05-28 16:51:03 +00:00
Colin Surprenant
c28ded78c9
fix JRuby resolv.rb leak (#10734) 2019-05-01 13:58:49 -04:00
Rob Bavey
4f270295a1 Adds cleanup after shutdown of plugin
Fixes #10691
2019-04-26 13:15:46 +00:00
Rob Bavey
9c09f1ee50 Add methods to clear PluginMetadata repositories
Fixes #10691
2019-04-26 13:15:46 +00:00
Ry Biesemeyer
1fa9454c7c adds LogStash::PluginMetadata for simple key/value plugin metadata
We need a way for a plugin to register simple metadata about external
resources it connects to in order to implement a Monitoring feature in which
an Elasticsearch Output Plugin can store the connected cluster's uuid (#10602)

Here, we add a generic `LogStash::PluginMetadata` along with a registry, and
expose an accessor on `LogStash::Plugin#plugin_metadata` so that instances
can access their own metadata object.

Fixes #10691
2019-04-26 13:15:45 +00:00
Jordan Johnson-Doyle
30879b293a Add tests for LogStash::Codec::Delegator
Fixes #10614
2019-04-11 13:10:18 +00:00
Rob Bavey
fb5eba8c8a Fix issue setting 'enable_metric => false' on a plugin
This commit fixes a ClassCastException which happens when
 a plugin has the `enable_metric` setting set to false - a
 NullMetricExt is assumed, but that is only created when
 'metric.collect' is set to 'false' in the Logstash configuration,
 not when an individual plugin disables its metrics.

Fixes #10538
2019-03-13 10:43:17 +00:00
Rob Bavey
95a0362fb9 Mute Failing Test on Windows
Mute mixin_spec, tracked by #10454

Fixes #10455
2019-02-15 19:44:21 +00:00
Rob Bavey
51d7723fb6 Remove unnecessary option to not require host in SafeURI
Fixes #10414
2019-02-08 14:14:33 +00:00
Rob Bavey
795fd98e52 Better handle malformed URIs
Raise an error if a URI has inadvertently been supplied without a host

Fixes #10414
2019-02-08 14:14:33 +00: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
Dan Hermann
48ee9987cc
Native support for Java plugins (beta) (#10232) 2019-02-04 11:36:36 -06:00
Colin Surprenant
f08b8c5076
fix agent silent exit upon pipelines reloading (#10346) 2019-01-31 15:48:50 -05:00
Dan Hermann
19554259b8 add option for PQ checkpoint retry
Fixes #10234
2019-01-02 21:15:38 +00:00
Dan Hermann
e89501e47e Java plugin API
Fixes #10216
2018-12-18 00:39:59 +00:00
Joao Duarte
e4159d0fb6 setting a list config to empty array should not result in nil
if a plugin author defines a config parameter as:

  config :retryable_codes, :validate => :number, :list => true, :default => [429]

And a user configures the plugin as:

  plugin { retryable_codes => [] }

It's expected that the retryable_codes parameter is an empty array and not a nil object

This PR changes this behaviour to generate an empty array

Fixes #10179
2018-11-27 14:00:26 +00:00
Guy Boertje
0e1b630502 Fix for failing spec in os_spec.rb
Fixes #10022

Fixes #10024
2018-09-26 17:45:22 +00:00
Colin Surprenant
1329e67174
run Agent specs using both memory and persisted queue (#10009)
* useless throws declaration

* run all specs using both memory and PQ
2018-09-25 12:33:51 -04:00
Guy Boertje
cdc1015629
Make cgroups more robust and provide the override similar to ES (#9999)
* Make cgroups more robust and provide the override similar to ES
and Kibana

This should go out as soon as possible and backport to 5.6

* refactor as per comments

Fixes #6797
Fixes #6824 
Fixes #7928
Fixes #8792
Fixes #9907
2018-09-22 12:13:32 +01:00
Joao Duarte
32027a44a9 disable spec/logstash/agent_spec.rb:409
Fixes #9908
2018-08-16 12:53:17 +00:00
Joao Duarte
9816af6c40 support more than 3 identifiers in cloud id
Fixes #9882
2018-08-09 13:14:26 +00:00
Joao Duarte
9f243d83f4 support port customization in cloud id
Fixes #9877
2018-08-08 10:47:42 +00:00
Ry Biesemeyer
d6f7f037f3
BREAKING: FieldReference - strict mode cutover (#9543)
* noop: swap expected/actual in tests so failures read correctly

* field_reference: fixes crash and adds many edge-case test cases

Some pathological inputs can cause `FieldReference#parse(CharSequence)` to
throw an `ArrayIndexOutOfBounds` exception, which hard-crashes the entire
Logstash process because this Java-based exception is not caught by the Ruby
plugins.

Instead, proactively throw a new runtime exception indicating that we
encountered illegal syntax, and adjust the ruby event wrapper to re-throw
a ruby RuntimeException that can be handled in the normal way.

Additionally, this commit adds specs for the current behaviour of a wide
variety of illegal-syntax inputs, to ensure we don't accidentally change
the current behaviour.

* field_reference: break legacy tokenizer out, lay groundwork for strict-mode

Extracts the bulk of the current `FieldReference#parse(CharSequence)` method
out into its own `LegacyTokenizer` class verbatim to simplify subsequent
review as we add a strict-mode tokenizer.

* field_reference: add strict-mode and compat-mode

Adds a strict-mode FieldReference tokenizer, which throws an illegal syntax
exception when it encounters illegal syntax.

Adds a compat-mode FieldReference tokenizer, which _warns_ when it encounters
an input that would produce a different output under the strict-mode parser,
but otherwise behaves the same as the legacy-mode parser

Enables users to opt-in to the strict-mode parsing, or to opt-out of the
warnings using a command line flag or a settings-file directive

* field_reference (BREAKING): remove LEGACY and COMPAT for 7.0
2018-07-23 10:42:48 -07: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
Armin
52e4f49177 JAVAFICATION: Move Ruby output calls to caching callsites
Fixes #9751
2018-06-16 14:50:27 +00:00
Armin
7bf2d129d0 MINOR: Move more dynamic Ruby calls to typed Java calls
Fixes #9743
2018-06-15 14:29:35 +00:00
Armin
30e055b1bf JAVAFICATION: Move more of the Java pipeline to Java
Fixes #9723
2018-06-12 13:50:15 +00:00
Dan Hermann
cc6ee1aeeb port output_delegator_spec to Java
Fixes #9717
2018-06-08 13:06:12 +00:00
Armin
76bb37166f TESTS: Fix RSpec CLI invocation
Fixes #9673
2018-06-07 12:39:11 +00:00
Tamara Braun
1cc5358892 Moved ConvergeResult to Java
Fixes #9699
2018-06-07 09:18:14 +00:00
Armin
0aa798f350 JAVAFICATION: Move QueueFactory to Java
Fixes #9693
2018-05-31 11:32:13 +00:00
Armin
6352001177 BUG: Fix incorrect type handling between Java pipeline and Ruby pipeline
Fixes #9671
2018-05-30 11:24:14 +00:00
Armin
417afd1c5a JAVAFICATION: Ported ShutdownWatcher to Java
Fixes #9670
2018-05-29 15:57:13 +00:00
Tamara Braun
7d6acf1799 Port HooksRegistry to Java
Fixes #9665
2018-05-28 06:45:51 +00:00
Dan Hermann
75684020e5 port SecretStore to Java
Fixes #9662
2018-05-25 20:47:34 +00:00
Armin
8103bff757 JAVAFICATION: Port RubyTimestamp test to JUnit
Fixes #9661
2018-05-25 12:07:50 +00:00
Andrew Cholakian
2c4cfeb990 Fix converge spec that didn't wait for agent to converge
This spec had a race, the start_agent invocation this depends on doesn't wait
until the state has converged at least once.

An example failure is here: https://logstash-ci.elastic.co/job/elastic+logstash+6.x+multijob-unix-compatibility/os=debian/121/console

The message was:

```
22:34:08     Failures:
22:34:08
22:34:08       1) LogStash::Agent Agent execute options when `config.reload.automatic` is set to`FALSE` and successfully load the config converge only once
22:34:08          Failure/Error: expect(source_loader.fetch_count).to eq(1)
22:34:08
22:34:08            expected: 1
22:34:08                 got: 0
22:34:08
22:34:08            (compared using ==)
22:34:08          # /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/logstash-core/spec/logstash/agent/converge_spec.rb:120:in `block in (root)'
22:34:08          # /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/spec/spec_helper.rb:50:in `block in /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/spec/spec_helper.rb'
22:34:08          # /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/spec/spec_helper.rb:43:in `block in /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/spec/spec_helper.rb'
22:34:08          # /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/vendor/bundle/jruby/2.3.0/gems/rspec-wait-0.0.9/lib/rspec/wait.rb:46:in `block in /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/vendor/bundle/jruby/2.3.0/gems/rspec-wait-0.0.9/lib/rspec/wait.rb'
22:34:08          # /var/lib/jenkins/workspace/elastic+logstash+6.x+multijob-unix-compatibility/os/debian/lib/bootstrap/rspec.rb:13:in `<main>'
22:34:08
22:34:08     Finished in 5 minutes 27 seconds (files took 8.75 seconds to load)
22:34:08     2877 examples, 1 failure, 5 pending
```

Fixes #9643
2018-05-23 00:35:30 +00:00
Andrew Cholakian
4c767c059e Wait longer and more reliably for agent specs.
These agent specs occasionally time out. This removes our use of the unreliable Timeout gem
and also lengthens the waiting period before failure

Fixes #9639
2018-05-22 20:58:19 +00:00
Andrew Cholakian
fb16b7b984 Shutdown agent after pipelines
I actually am not sure if this matters, but it seems like it won't hurt,
and is a more sane ordering of things. I have a suspicion that in some cases
the agents get stuck and don't shut down because of this ordering, but I can't
prove it

Fixes #9628
2018-05-22 14:51:17 +00:00
Armin
a9217255a7 JAVAFICATION: Port pipeline reporter to Java
Fixes #9631
2018-05-22 12:47:13 +00:00
Armin
0dc5c4af64 JAVAFICATION: Port EventDispatcher to Java
Fixes #9633
2018-05-22 12:19:45 +00:00
Joao Duarte
1fd34822b9 add custom clamp appender to fix path.plugin
the path.plugin setting is a multi valued option, clamp uses
an implicit appender method for adding values to an array.
because we patch Clamp to use LogStash::SETTINGS underneath,
we must tune both reading/writing and appending values.
This last wasn't being customized, so this path redefines the
append_method method to add an element to a setting's value

Fixes #8887
2018-05-18 08:58:31 +00:00