Commit graph

835 commits

Author SHA1 Message Date
Tal Levy
1b2f7a7668 Migrate Logstash to Log4j2 Logging (#5651)
Migrate to use Log4j2 for Logstash logging
2016-08-25 10:30:22 -07:00
Andrew Cholakian
6de1c83c4a Use the id, not plugin_args as plugin info in pipeline reporter for outputs.
The plugin args are not really necessary for reporting. Now that we have unique IDs
that's a better way to figure which output is which without potentially sharing
sensitive data.

This fixes hanging tests in the previous commit

Fixes #5827
2016-08-25 09:37:18 -04:00
Andrew Cholakian
3696bcad4a Improve OutputDelegator public API
This minimizes the OutputDelegator public API

Fixes https://github.com/elastic/logstash/issues/5813

Fixes #5827
2016-08-25 09:37:18 -04:00
Andrew Cholakian
cf3557a851 Add workers not supported error message for legacy plugins.
Fixes https://github.com/elastic/logstash/issues/5823

Fixes #5826
2016-08-24 15:51:13 -04:00
Andrew Cholakian
5be74fca22 Properly set Output Metrics in Output Delegator Strategy.
Fixes https://github.com/elastic/logstash/issues/5810

Fixes #5825
2016-08-24 15:39:19 -04:00
Colin Surprenant
31392e7fb0 base SignalEvent class and cleanup LogStash namespace 2016-08-23 17:12:19 -04:00
Pier-Hugues Pellerin
3f4190e7f4 Make sure the name of the plugin is saved in the metric store
Fixes: #5799

Fixes #5800
2016-08-23 11:55:29 -04:00
Joao Duarte
8cd64ee07e allow deprecated quiet/debug/verbose flags to be set
Fixes #5785
2016-08-23 10:01:48 -04:00
Andrew Cholakian
33c0a8e89d Add new Codec#encode_sync, Codec#multi_encode and Output#multi_receive_encoded methods.
These methods allow outputs to receive their events pre-encoded for them
by the pipeline. This is mostly useful in the context of `#shared` outputs, for whom
encoding a discrete batch in a threadsafe way is not necessarily straightforward.

It would be advised for codecs to prefer `#multi_encode` as the main way of operating
as the standard `#encode` method is not threadsafe.

Fixes #5770
2016-08-22 14:08:04 -04:00
Pier-Hugues Pellerin
5d4a3aeeb6 Add GC stats to the api
This PR introduce GC stats in the form of `collection_time` and `collection_count`, it takes the configured gc and categorize them
into old and young.

Example output:

```
gc: {
  collectors: {
    young: {
      collection_time_in_millis: 22101,
      collection_count: 5452
    },
    old: {
      collection_time_in_millis: 57,
      collection_count: 1
    }
  }
}
```

Fixes: #5730

Fixes #5788
2016-08-22 13:17:25 -04:00
Pier-Hugues Pellerin
cf3a424609 Clear the inflight clock hashmap after stopping a clock
Fixes #5792
2016-08-22 13:16:39 -04:00
Pier-Hugues Pellerin
ab9f3b79be Expose duration of the Filter+Output part of the pipeline
This PR will expose the time spend of a batch in the filter + output

Ouput:
http://localhost:9600/_node/stats/pipeline
```
events: {
	duration_in_millis: 18364,
	in: 309325,
	filtered: 309325,
	out: 309325
},

	```

	Fixes: #5731

Fixes #5792
2016-08-22 13:16:38 -04:00
Andrew Cholakian
f57b5f0cb1 Cleanup OutputDelegatorStrategy refactor
This fixes two issues:

1. This fully removes the xopts parameter which for Shared and Single concurrency would prevent outputs from receiving their parameters
2. This cleans up the injection of the OutputDelegatorStrategyRegistry.

This also bumps the plugin api version to 2.1.12

Fixes #5794
2016-08-22 12:54:57 -04:00
Pier-Hugues Pellerin
aaa3352d0f Adding the values for the automatic reloading to the API
```
config_reload_automatic: true,
config_reload_interval: 3
```

Fixes: #5681

Fixes #5780
2016-08-22 12:03:27 -04:00
Pier-Hugues Pellerin
1327fab555 Remove mem block from /node
Fixes #5789
2016-08-22 11:55:08 -04:00
Joao Duarte
60cf97c8c2 don't warn of wrong path.settings with --help
Fixes #5786
2016-08-22 10:56:24 -04:00
Joao Duarte
bb46aa6188 tolerate bad path.settings when --help is present
Fixes #5786
2016-08-22 10:56:23 -04:00
Pier-Hugues Pellerin
672b369c41 --http.port Now accept a port range
This PR does a few modifications for our webserver:
 - Add a PortRange setting type.
 - allow the --http.port option to accept a port range or a single port, when a range is provided Logstash will incrementally try this list to find a free port for the webserver.
 - Logstash will report in the log which port it is using. (INFO LEVEL)
 - It refactors a few methods of the webserver.
 - It adds test for the binding of the ports.

Notes:

Port range can be defined in the logstash.yml or pass via the command line like this.

 `bin/logstash -e 'input { generator {}} output { null {}}' --log.level verbose --http.port 2000-2005`

Fixes #5774
2016-08-19 08:04:00 -04:00
Andrew Cholakian
f68b2c0841 Cleans up output delegators and simplifies a few other aspects of plugins
The new way Output Delegators work is that events flow from:
OutputDelegator -> OutputDelegatorStrategy -> Output

The output delegator handles all the common denominator tasks (like metrics) and
a few other things. The OutputDelegatorStrategy handles concurrency and Output instantiation.
This is a significant improvement and simplification over the past where we used mixins and dynamic method
redifinition.

This removes the concept of plugin 'unique_names' and replaces it with the 'id'.
Also consistently autogenerates plugin IDs based on a given config file using SHA1 hashing.

Fixes #5752
2016-08-18 16:50:41 -04:00
Joao Duarte
f00fadd6fc add more numeric setting classes and control cli numeric coersion
Fixes #5773
2016-08-18 09:20:26 -04:00
Pier-Hugues Pellerin
6d0af1b9b1 make the human? method part of the base api class
Fixes #5766
2016-08-18 09:16:59 -04:00
Pier-Hugues Pellerin
db5edacf9a adding test for the human hot_threads call
Fixes #5766
2016-08-18 09:16:59 -04:00
Pier-Hugues Pellerin
6c88649afe Small improvements for the hot_threads api
- Fix the typo in the human format
- Make sure we use the I18n string for the output

Fixes #5766
2016-08-18 09:16:59 -04:00
Pier-Hugues Pellerin
226c51ca0e Add GC Strategy under /note/jvm
Fixes: #5755

Fixes #5775
2016-08-18 08:55:00 -04:00
Joao Duarte
59bc304f27 show meaningful error message with an unknown command
Fixes #5772
2016-08-17 13:42:28 -04:00
Suyog Rao
e7dcdd66ba Bump to 5.0.0-alpha6, next release (#5751) 2016-08-09 23:33:15 -07:00
Andrew Cholakian
3aa592f46d Fix broken plugin tests that didn't have a defined data.home
This is done by providing a default data.home in tmp for environments other than a packaged logstash distro.

This is a hack and should be replaced by something better in the future.

Fixes #5706
2016-07-28 16:35:44 -04:00
Guy Boertje
fef45b8aa0 Add queue client support (and batch object) to pipeline (#5560)
* add batch object and queue client support to pipeline

* post review updates

* add note about inflight_batches to pipeline and wrapped_sync_queue

* remove more whitespace changes

* remove more whitespace changes

* rename add to merge + refactor event fill on ReadBatch.new

* better handle the initial filling of the batch, handle merging better
2016-07-27 16:21:11 +01:00
Pere Urbón
cfd331b230 add namespaced metrics for inputs (#5668) 2016-07-21 08:25:29 -07:00
Pere Urbon-Bayes
b0e1ded0fb move the payload filter to the respond_with method helper
Fixes #5630
2016-07-20 06:01:34 -04:00
Pere Urbon-Bayes
51fd381b04 add generic filter for _node/stats api
ammend wrong rebase in terms of the hot_threads api fix

Fixes #5630
2016-07-20 06:01:34 -04:00
Pere Urbon-Bayes
e812821fd2 add the magic header # encoding: utf-8 to a few files, plus refactoring the hot threads code to be in single location
Fixes #5630
2016-07-20 06:01:34 -04:00
Pere Urbon-Bayes
0a59cde937 Introduce the first level, comma separated selector for fields. Also corrected an issue where memory refence was also using mem.
Fixes #5630
2016-07-20 06:01:34 -04:00
Pere Urbon-Bayes
fcfebb7535 add option to filter payload (first level) in the node api
Fixes #5630
2016-07-20 06:01:34 -04:00
Pere Urbon-Bayes
2249a03edb rename _node/stats/pipeline pipeline into plugins as is more clean that the resources means
Fixes #5623
2016-07-19 08:50:41 -04:00
Pere Urbon-Bayes
dafb7eafc6 /_node/stats/events object+resource is removed as these metrics now instead reside under the pipeline stats /_node/stats/pipeline
Fixes #5623
2016-07-19 08:50:41 -04:00
Pere Urbon-Bayes
97d679f933 Removed /_node/stats/mem and insted nested them under /_node/stats/jvm along with the ‘thread’ stats
Fixes #5623
2016-07-19 08:50:41 -04:00
Pere Urbon-Bayes
e35addbbb5 add /_node/stats/pipeline inside /_node/stats main resource
Fixes #5623
2016-07-19 08:50:41 -04:00
Pere Urbon-Bayes
d54c66a8dd fix human parameter processing
Fixes #5621
2016-07-15 03:12:15 -04:00
Joao Duarte
87e13ced5b fix string setting validation of possible values
Fixes #5628
2016-07-14 04:01:24 -04:00
Andrew Cholakian
8cd1a475fe Add support for hostname:port syntax to SafeURI class
This is a deviation from what the ruby URI class normally allows.
With this patch users can use "myhost:123" as an option and have it do the
right thing, as opposed to before where they'd get an error and have to
use "//myhost:123".

Fixes #5618
2016-07-12 12:27:18 -04:00
Joao Duarte
4cf8031a49 bump to 5.0.0-alpha5
Fixes #5585
2016-07-05 10:03:22 -04:00
Pier-Hugues Pellerin
64f9a27208 Review changes
Fixes #5542
2016-06-27 18:37:02 -04:00
Pier-Hugues Pellerin
6fdb1935c3 Making sure the input plugin have access to the metric
Fixes #5542
2016-06-27 18:37:02 -04:00
Pier-Hugues Pellerin
363879546d Always provide a default metric to the plugin instance
Fix an issue when running tests of the plugin in isolation, no default
metric was created and the metric was nil.

This commit change the behavior to always return a `NullMetric` when
plugin instances are created outside of the pipeline.

Added tests to cover all the base class of plugin that can record
metric.

Fixes #5542
2016-06-27 18:37:02 -04:00
Pier-Hugues Pellerin
cfe71cb58b When running logstash in debug mode, display the stacktrace
Fixes #5542
2016-06-27 18:37:01 -04:00
Pier-Hugues Pellerin
988793dbb1 Add more testing around the NullMetric implementation
The current test where only checking if the `NullMetric` Interface was
matching the original metric interface, this PR add more test around the
actual methods and fix an issue with `decrement` using too much
arguments in the context of a namespaced metric.

The test were also move into a shared example to be used in both the `NullMetric`
and the `NamedspacedMetric`.

Also the NullMetric class will no use the same validation for keys as the namespaced class and will
reject empty or nil keys.

Fixes #5545
2016-06-27 11:27:20 -04:00
Joao Duarte
c0c9a3babc add data.path setting
Fixes #5528
2016-06-24 07:32:25 -04:00
Pier-Hugues Pellerin
1dd44383c7 Make sure the namespace metric is send to the plugin correctly and MetricType#To_hash wont return all the values
Fixes: #5529

Fixes #5532
2016-06-22 09:24:33 -04:00
Andrew Cholakian
d01b5f6b9c Add stats default fields (hostname, http_address, version)
Fixes #5520
2016-06-20 14:13:40 -04:00