Commit graph

3730 commits

Author SHA1 Message Date
Colin Surprenant
5adf2b0426 removed started? and use AtomicBoolean for ready?
cleanup @filter_to_output initialization

remove @run_mutex, use ready? to synchonize shutdown agains startup sequence

remove ShutdownSignal handling & cleanup
2015-09-18 16:22:50 -04:00
Joao Duarte
3bdac41a6c trigger input plugin shutdown using out of band call
Currently, during shutdown, the pipeline loops through input workers
and calls Thread.raise on each input thread. Plugins rescue that
exception to exit the `run` loop. Afterwards, `teardown` is called for
any additional bookkeeping.

This proposal exposes a `stop` call on the input plugin class to alert
an input that it should shutdown. It is the plugin job to frequently
poll an internal `stop?` method to know if it's time to exit and
terminate if so.

The `teardown` method remains to do the additional bookkeeping, and it
will be called by the inputworker when `run` terminates.

add concurrent-ruby as logstash-core dependency

make Plugins::Input#stop? public

In some scenarios it's necessary for the inputworker or the pipeline
to know that the plugin is in a shutdown mode

document why inputworker sleeps on StandardError

better debug message when input plugin raises exception during shutdown
2015-09-18 16:22:30 -04:00
Pier-Hugues Pellerin
186806d64c Cleanup of require-helper.rb
This file isn't used in the code at all, It was probably used at some
point but its not the case anymore.

Fixes #3938
2015-09-18 18:20:32 +00:00
Pier-Hugues Pellerin
0ae58804ee Remove multiqueue
This file was probably used at some point but its not the case anymore

Fixes #3939
2015-09-18 18:20:13 +00:00
Pier-Hugues Pellerin
fe68307991 Remove unused files
Remove related files for compiling the treetop grammar we have refactored the
makefile using rake. If you want to generate a new parser you can use
this command.

`rake compile:all`

Fixes #3941
2015-09-18 18:19:38 +00:00
Pier-Hugues Pellerin
935ac9285b String Interpolation skip the last character
This PR fix a problem when doing the interpolation with a string that
did not end with a fieldref but with a character. The interpolation was
ignoring the last character.

Example:
```
"%{type}|" => "syslog"
```

Fixes #3931

Fixes #3937
2015-09-18 15:39:44 +00:00
Pier-Hugues Pellerin
b863ace5ab Silence deprecation warnings from concurrent-ruby
Concurrent-ruby is throwing warning when running under jdk7,
we have decided to silence theses errors unless you run logstash with
the `--debug` flag.

Fixes #3869
2015-09-15 13:04:12 -07:00
Pere Urbon-Bayes
a3fc9476cc Fix the update command to only work with installed plugins gems so it's not having problems with not purged plugins
Fixes #3731
2015-09-11 06:49:54 +00:00
Suyog Rao
309611ba52 Revert version change to 2.0.0.dev because plugins constraint checks fail
Fixes #3865
2015-09-03 20:16:45 +00:00
Suyog Rao
bdacba71e3 Bump master to next version
Fixes #3863
2015-09-03 19:45:54 +00:00
guyboertje
7bb94d0692 add test for compact and compact! in java_integrations
Fixes #3772
2015-09-03 19:43:10 +00:00
guyboertje
e4d4c0cec8 add compact and compact! methods to java::util::Collection
Fixes #3772
2015-09-03 19:43:10 +00:00
Pier-Hugues Pellerin
9242ae551b Remove watchdog
This watchdog thread watching is currently unused and bugged in some
context, this PR remove any mention of it.

Ref #3828

Fixes #3830
2015-09-03 19:03:06 +00:00
Pere Urbon-Bayes
ae4c49be3b Exclude pre releases when checking if the update is targetting a major release in the plugin manager, as bundler is not going to update anyway to this version without an explicit install command.
Fixes #3826
2015-09-02 21:17:02 +00:00
Andrew Cholakian
c4d24c13ac Java bad version check should return a false, not nil
Fixes #3824
2015-08-31 14:16:14 +00:00
Andrew Cholakian
f2fcc41aee Non Oracle Javas are all detected as 'good'
Fixes #3824
2015-08-31 14:16:13 +00:00
Pere Urbon-Bayes
028d76497c add the missing magic header # encoding: utf-8 so all internal strings are UTF-8 in Ruby < 2.0
Fixes #3723
2015-08-17 13:30:07 +00:00
Pere Urbon-Bayes
2b6485f28e add the magic header encoding: utf-8 in the string interpolation to be sure all is utf-8
Fixes #3718
2015-08-17 13:21:25 +00:00
Pere Urbon-Bayes
f2713910bf remove unnecessary encode when doing sprintf
Fixes #3718
2015-08-17 13:21:25 +00:00
Pere Urbon-Bayes
45e768e833 makes sure that all property interpolation throught event.sprintf are returned in UTF-8
Fixes #3718
2015-08-17 13:21:24 +00:00
Andrew Cholakian
9e88c90b28 Handle non-hotspot javas in version check
Fixes #3685
2015-08-03 21:25:58 +00:00
Pier-Hugues Pellerin
cbfd1eebf5 Do not force a verify_mode with a our stronger ssl settings
We have discovered that in some cases and some plaftorms
configuring a default `verify_mode` when creating a SSL/TCPServer
could make the certificate verification fail. Ruby default behavior is
to use `NIL` when creating a new ssl context, this revert that change.

keep in mind that all TCP clients using SSL **must** use `VERIFY_PEER`
as their verify mode to prevent man in the middle attack.

Fix: https://github.com/elastic/logstash/issues/3657
2015-07-31 20:56:11 -04:00
Matthew L Daniel
cf49aab8b4 Ensure config-string matches the real defaults
Since the defaults are constant strings, ensure the `I18n` text uses the
same defaults as does the Ruby code

Also, update the comment about line length to match the "55" that is
both correct and used further down in the file.

Fixes #1456
2015-07-22 12:49:57 -07:00
Colin Surprenant
52aec3b244 add back --pluginpath option
support adding plugin paths

support --pluginpath option

missing doc

refactor using @purbon suggestions

Agent#configure_plugin_paths spec

solves #3580
2015-07-15 16:43:13 -04:00
Joao Duarte
e370ff5476 move reporter code to separate file and change report format
Fixes #3484
2015-07-13 22:45:51 +00:00
Joao Duarte
84be8d34a6 add a periodic report of inflight events
Fixes #3484
2015-07-13 22:45:51 +00:00
Jordan Sissel
fbf8e1e320 Improve default security for SSLContext with a monkeypatch.
New defaults:
* Cipher suite based on Mozilla's Intermediate set from
  https://wiki.mozilla.org/Security/Server_Side_TLS (at time of writing)
* Disable SSLv2 explicitly
* Disable SSLv3 explicitly
* Disable compression if possible

The SSL option setting came from the ruby-ftw library's FTW::Connection
(apache 2 licensed, I am author), and transitively through work
published by jmhodges to improve Ruby's SSL strength.

I include specs to ensure we never include export or weak ciphers by
default.

Using this patch to test the security improvements according to
`www.howsmyssl.com` shows much improved results:

---

Testing this:

```
ruby -r ./lib/logstash/patches/stronger_openssl_defaults.rb  -ropenssl -rsocket -rjson -rawesome_print -e 'c = OpenSSL::SSL::SSLContext.new; t = TCPSocket.new("www.howsmyssl.com", 443); o = OpenSSL::SSL::SSLSocket.new(t, c); o.connect; o.puts "GET /a/check HTTP/1.1\r\nHost: www.howsmyssl.com\r\n\r\n"; headers,body = o.read.split("\r\n\r\n", 2); puts body'
```

(I processed the JSON output w/ jq for easier reading)

The purpose of the above is to test the default behavior of SSLContext.

* JRuby 1.7.19 w/ this patch reports no cipher problems.
* JRuby 1.7.19 without this patch has several weak ciphers used:

```
  "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_DHE_RSA_WITH_DES_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_RSA_EXPORT_WITH_RC4_40_MD5: [\"uses keys smaller than 128 bits in its encryption\",\"use RC4 which has insecure biases in its output\"]",
  "TLS_RSA_WITH_DES_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_RSA_WITH_RC4_128_MD5: [\"use RC4 which has insecure biases in its output\"]",
  "TLS_RSA_WITH_RC4_128_SHA: [\"use RC4 which has insecure biases in its output\"]"
```

Under MRI, similar cipher selection problems are observed without this patch (weak export
ciphers, other weak small-key ciphers, RC4 complaints). With this patch, no cipher complaints
are reported by www.howsmyssl.com

One other note: Because JRuby defaults to TLS 1.0 and only makes CBC ciphers
available under the Mozilla Intermediate cipher set, I believe (and
howsmyssl.com agrees) that these defaults still make the BEAST exploit a
problem. Switching to TLS 1.1 should fix this, but we need to do more research
to determine the what, if any, impact it will have if we force TLS 1.1 to be
the default..

Fixes #3579
2015-07-13 21:41:15 +00:00
Andrew Cholakian
f7b76fa2ae Fix namespacing for unicode trimmer
Fixes #3593
2015-07-10 21:34:52 +00:00
Joao Duarte
d7bfd25dab make plugin#inspect show number config parameters
Fixes #3564
2015-07-10 15:24:24 +00:00
Pere Urbon-Bayes
bd7516108f workarround the version check for pre released plugins as looks like rubygems is not activating them by default
Add a pre release gem test by using a mock to reproduce the behaviour
reaised by Gem::Specification.find_by_name when dealing with pre release
gems.

Fixes #3476
2015-07-02 16:06:48 +00:00
Pere Urbon-Bayes
a81f0249b1 locate plugin manager command dependencies to the specific commands as it should be
Fixes #3509
2015-07-02 14:17:50 +00:00
Pier-Hugues Pellerin
3f38575758 Wrong namespace for json serialization
Fixes #3536
2015-06-30 20:53:14 +00:00
Andrew Cholakian
f0e5bcd597 Make inspecting collections a bit more friendly
Fixes #3474
2015-06-30 17:02:58 +00:00
Andrew Cholakian
13ed78790f Add unicode trimmer utility function
Fixes #3505
2015-06-26 20:13:59 +00:00
Pier-Hugues Pellerin
1380119ac8 Removing reference of fieldreference
Fixes #3467
2015-06-26 17:35:46 +00:00
Pere Urbon-Bayes
cf10890d63 fix the coverage analysis throw simplecov to take care of all files
make the eager loading patterns consistent in the spec_helper.rb file

make the setup-simplecov task not a dependency, but an explicit task only executed when ENV['COVERAGE'] is defined

refactor eager loading code plus add some documentation to the setup-simplecov task

Added more comments to the test:setup task

Fixes #3465
2015-06-25 15:36:57 +00:00
wiibaa
e715248b4a harmonize add_field and add_tag behavior in inputs and filters
Fixes #2390
2015-06-24 20:52:14 +00:00
Colin Surprenant
535027dfd9 use Environment.jruby?
Fixes #3450
2015-06-19 21:39:50 +00:00
Andrew Cholakian
cad497655e Tighten up JavaVersion.version
Fixes #3452
2015-06-19 19:07:25 +00:00
Andrew Cholakian
3d57f5fd0a Log bad java version as well as printing it to stderr
Fixes #3452
2015-06-19 19:07:24 +00:00
Andrew Cholakian
b91f01e8fe Better comments on JavaVersion
Fixes #3452
2015-06-19 19:07:24 +00:00
Andrew Cholakian
64b66fd6a5 Use implicit rather than explicit return
Fixes #3452
2015-06-19 19:07:23 +00:00
Andrew Cholakian
259f3daeb2 Return explicit false on bad java version
Fixes #3452
2015-06-19 19:07:22 +00:00
Andrew Cholakian
f57cd98a91 Correctly support java 2.x.x in java version check should that ever happen
Fixes #3452
2015-06-19 19:07:21 +00:00
Andrew Cholakian
b0cc23ff37 Stronger warning on bad java version
Fixes #3452
2015-06-19 19:07:21 +00:00
Andrew Cholakian
5729fb9a0a Check java versioning
Fixes #3452
2015-06-19 19:07:20 +00:00
Pier-Hugues Pellerin
280db59a3a Remove old methods, use a module for the singleton
Fixes #3425
2015-06-18 17:59:50 +00:00
Pier-Hugues Pellerin
8a78be0c48 matches cannot be nil
Fixes #3425
2015-06-18 17:59:49 +00:00
Pier-Hugues Pellerin
050c6badad comments
Fixes #3425
2015-06-18 17:59:48 +00:00
Pier-Hugues Pellerin
896a91d872 Bad interpolation when issue mixed template like foo %{bar} %{+YYYY}
Fixes #3425
2015-06-18 17:59:48 +00:00