Commit graph

440 commits

Author SHA1 Message Date
Guy Boertje
eba128c968 Allow for exception instances to get serialized in JSON logging 2016-11-30 15:43:57 -08:00
Joao Duarte
bc3bcfde24 rename queueMaxSizeInBytes to queueMaxBytes and currentSize to currentByteSize
Fixes #6297
2016-11-29 05:10:42 -05:00
Joao Duarte
4a5aa90466 add ruby wiring to the queue.max_size setting
Fixes #6297
2016-11-29 05:10: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
Andrew Cholakian
c03f30fedb Fix filter 'id' naming to be consistent with inputs / outputs
The filters were the only category prefixing IDs with their plugin names

Fixes #6259
2016-11-22 13:35:30 -05:00
Pier-Hugues Pellerin
cd84576584 Theses core input are not currently used inside logstash so it make sense to remove them
Fixes #6268
2016-11-17 11:54:33 -05:00
Tal Levy
6e01395dde add logstash-core resources to classpath during development
Fixes #6235.

Fixes #6237
2016-11-16 08:50:46 -05:00
Pier-Hugues Pellerin
169ba4636a move the loadAverage class into his own file and do the same for the specs
Fixes #6240
2016-11-14 08:59:39 -05:00
Pier-Hugues Pellerin
80c2019dcf Monitor the load average of the machine and display it in the api
This PR add new information in the /_node/stats api and will return the
load average of the machine in the following formats depending of the
platforms that logstash is running on:

**Linux**
```json
{
    "cpu" : {
      "percent" : 26,
      "load_average" : {
        "1m" : 2.826171875,
        "5m": 1.8261718,
        "15m": 1.56566
      }
    }
}
```

**MacOS and other platform that the OperatingMXBean understand**
```json
{
    "cpu" : {
      "percent" : 26,
      "load_average" : {
        "1m" : 2.826171875,
      }
    }
}
```

Load average is not available on Windows

Fixes: #6214

Fixes #6240
2016-11-14 08:59:38 -05:00
Suyog Rao
183ab07ec0 shutdown after spec
Fixes #6236
2016-11-11 11:52:18 -05:00
Suyog Rao
e78fce609b Add JVM uptime stats
Fixes #6236
2016-11-11 11:52:18 -05:00
Suyog Rao
77294b9f5a Add uptime millis stats
Fixes #6236
2016-11-11 11:52:18 -05:00
Pier-Hugues Pellerin
132dd7af89 bad merge
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
a732d0cdea Add a transient_settings concept to the settings handling
When we load a yml file in logstash if a key isn't not found in the
settings, we move that key and the corresponding value to a
`transient_settings` hash. This give the time to the plugin to register
new settings. When we call #validate_all we merge the
`transient_settings` hash and do the validation, if a key is not found
at that stage an excepton will be throw.

Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
413dc350d2 Chagne PluginRegistry -> PLUGIN_REGISTRY
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
2dd8cf51fc fixes from reviews from @joao
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
3a652a3076 adjust the specs
Fixes #6109
2016-11-11 09:43:43 -05:00
Pier-Hugues Pellerin
58ccca7028 fixing the tests
Fixes #6109
2016-11-11 09:43:43 -05:00
Pier-Hugues Pellerin
6626fa897c This PR changes two things:
- Allow plugins author to decide how their plugins are structured
- Allow a new kind of plugin that allow plugins author to add hooks into logstash core.

Fixes #6109
2016-11-11 09:43:43 -05:00
Joao Duarte
a0f70777bc mark reload as failure if pipeline.run aborts
currently a reload is only marked as a failured if it fails the classic
config test check, where we check for parameter names, existing plugins, etc.

This change waits for the pipeline to transition to running before
marking the reload as success, otherwise it is a failure.

fixes #6195

Fixes #6196
2016-11-10 05:27:01 -05:00
Andrew Cholakian
80d21712c6 Add Persistent UUID for Agent
This adds two new fields 'id', and 'name' to the base metadata for API requests.
These fields are now returned at all API endpoints by default.

The `id` field is the persisted UUID, the name field is the custom name
the user has passed in (defaulted to the hostname).

I renamed `node_uuid` and `node_name` to just `id` and `name` to be
inline with Elasticsearch.

This also fixed a broken test double in `webserver_spec.rb` that was
using doubles across threads which created hidden errors.

Fixes #6224
2016-11-09 07:40:47 -05:00
Colin Surprenant
cb8d80a46f fix tagging edge cases
add comment and use Arrays.asList()

brain fart between camelCase and snake_case
2016-11-04 14:03:50 -04:00
Tal Levy
19d3232873 slowlog
Fixes #6128
2016-11-02 18:48:40 -04:00
Suyog Rao
5624b17735 Use stderr instead of puts
Fixes #6172
2016-11-02 15:51:59 -04:00
Suyog Rao
32363fb561 Make logstash.yml optional
5.0.0 required Logstash to have a valid logstash.yml before it could start successfully. This
was mostly fine for users who installed Logstash via tar.gz, but many many folks who install
it via packages still start Logstash manually. Also, our documentation uses -e flag for
getting started on Logstash and sending their first event.logstash.yml has only defaults defined,
and there is no required parameter to start Logstash. We should be able to use the defaults if no
logstash.yml. Obviously, this is not ideal from a user point of view, so we should log a warning but
continue to bootstrap.

Fixes #6170

Fixes #6172
2016-11-02 15:51:59 -04:00
Pier-Hugues Pellerin
d063c44293 This file isn't used all the observer logic is already handled in the periodic poller base class.
Fixes #6169
2016-11-02 14:08:26 -04:00
Pier-Hugues Pellerin
1d21530c56 Change how PeriodicPollers log their exception
In a busy logstash install and the way we interact with core stats from
the jvm or the os, the poller can timeout. This exception is logged as
an error. but this shouldn't impact normal operation.

This PR changes the following:

- Change the interval for 5s instead of 1s
- Make the timeout bigger 160s instead of 60
- Concurrent::TimeoutError will be logged using debug instead of error
- Any other exception will use the error level.
- add tests

Fixes: #6160
Fixes: #6158

Fixes #6169
2016-11-02 14:08:26 -04:00
Suyog Rao
ae60c7dfd4 -e and -f should merge even without valid conf file
Previously if both -e and -f was specified, LS required that
-f still have valid config file(s) before merging. This fixes it
to either have one of -f or -e provided

Fixes #6164
2016-11-01 18:37:38 -07:00
Colin Surprenant
761f9f1bc9 merge feature/java_persistence into master 2016-11-01 17:13:23 -04:00
Suyog Rao
8bf84c74c4 Fix user feedback message for package install
We were showing both INFO and ERROR for all cases which is confusing

Fixes #6061
2016-10-31 11:56:29 -04:00
Joao Duarte
7132c68cf4 allow the disabling of metric collection
if `metric.collect` is set to false then no metrics are collected
before this setting was necessarily set to true.

Fixes #6097
2016-10-24 11:33:20 -04:00
Joao Duarte
9622f9b5b1 skip reloading a pipeline if it has reloading turned off
Fixes #6093
2016-10-24 04:53:11 -04:00
Andrew Cholakian
07a4b82613 Require 'forwardable' in SafeURI
SafeURI requires forwardable, which is included elsewhere in logstash. Plugin tests using this validation don't load logstash in the right order for this to work, so we need an explicit require here.

Fixes #5978
2016-10-14 16:07:11 -04:00
Colin Surprenant
2b2972f7b8 fix for cancelled events issue #6055
update comments

preserve abort_on_exception state
2016-10-14 19:39:14 +02:00
Jordan Sissel
9a5b3436e2 WritableDirectory#value now creates the directory if needed.
This also makes the failure reports from WritableDirectory's validation
more specific (parent directory doesn't exist, or does exist and is
isn't writable, or the path itself isn't writable, etc).

Fixes #6023
2016-10-13 18:11:35 -04:00
Jordan Sissel
e98b1c6e14 Add Settings#validate_all and NullableString setting
This allows us to validate all settings after all the settings sources
have been processed (logstash.yml, flags, environment variables, etc)

NullableString is required for validation to pass on what were
previously String settings with nil defaults.

WritableDirectory's strict now defaults false to help with a problem
where the default path.data might not be writable *and* the user could
be specifying --path.data on the command line to compensate. Prior to
this, the default value would be validated and cause Logstash to
terminate on startup because of the default data directory was validated
before the flag override was applied.

To make this validate_all feature more useful, Setting#set will only
call validate if `strict` is true.

Fixes #6004

Fixes #6008
2016-10-11 16:21:34 -04:00
Andrew Cholakian
2c17c3e7e0 If a plugin lookup fails the error message is too vague to debug.
This problem is seen here:
https://github.com/elastic/logstash/issues/6019

This change will log extra information that will be helpful to the
debugging process.

Testing this out with jdbc-input 4.1.1 (cited in #6019 above) we now see
as output:

```
~/p/l/logstash-alt (better_plugin_error_messages) $ bin/logstash -e "input { jdbc {} } output { stdout {} }"
Sending Logstash logs to /Users/andrewvc/projects/lsp/logstash-alt/logs which is now configured via log4j2.properties.
[2016-10-10T16:38:50,723][WARN ][logstash.registry        ] Problems loading a plugin with {:type=>"input", :name=>#<LogStash::Registry::Plugin:0x50ec4e78 @type="input", @name="jdbc">, :path=>"logstash/inputs/jdbc", :error_message=>"uninitialized constant LogStash::PluginMixins::Jdbc::Cabin", :error_class=>NameError, :error_backtrace=>["org/jruby/RubyModule.java:2719:in `const_missing'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.1/lib/logstash/plugin_mixins/jdbc.rb:11:in `Jdbc'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.1/lib/logstash/plugin_mixins/jdbc.rb:9:in `(root)'", "org/jruby/RubyKernel.java:1040:in `require'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.1/lib/logstash/inputs/jdbc.rb:1:in `(root)'", "org/jruby/RubyKernel.java:1040:in `require'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.1.1/lib/logstash/inputs/jdbc.rb:4:in `(root)'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/plugins/registry.rb:1:in `(root)'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/plugins/registry.rb:59:in `lookup'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/plugin.rb:121:in `lookup'", "org/jruby/RubyKernel.java:1079:in `eval'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/pipeline.rb:418:in `plugin'", "(eval):8:in `initialize'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/pipeline.rb:90:in `initialize'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/agent.rb:195:in `create_pipeline'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/agent.rb:87:in `register_pipeline'", "/Users/andrewvc/projects/lsp/logstash-alt/logstash-core/lib/logstash/runner.rb:256:in `execute'", "/Users/andrewvc/projects/lsp/logstash-alt/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'", "/Users/andrewvc/projects/lsp/logstash-alt/lib/bootstrap/environment.rb:68:in `(root)'"]}
[2016-10-10T16:38:50,735][ERROR][logstash.agent           ] fetched an invalid config {:config=>"input { jdbc {} } output { stdout {} }", :reason=>"Couldn't find any input plugin named 'jdbc'. Are you sure this is correct? Trying to load the jdbc input plugin resulted in this error: Problems loading the requested plugin named jdbc of type input. Error: NameError uninitialized constant LogStash::PluginMixins::Jdbc::Cabin"}
```

Fixes #6020
2016-10-11 10:25:35 -04:00
Tal Levy
b013163f36 add file:// protocol prefix to log4j configuration filepath
fixes #5971

Fixes #6012
2016-10-07 17:22:05 -04:00
Joao Duarte
ce0c5e2bf2 skip sighup handling on windows
Fixes #6005
2016-10-07 10:39:28 -04:00
Suyog Rao
6f9ce48adb Fix issue with long message
Fixes #5999
2016-10-06 12:26:23 -04:00
Suyog Rao
7da292a3b0 Make sure we log stuff using logger
Partially addresses #5975

Fixes #5999
2016-10-06 12:26:23 -04:00
Pier-Hugues Pellerin
cfd39c377e Correctly calculate the time spend in the filter + output block
This PR fix an issue where the time was calculated but no work was done
on the event. This code make sure we have at least one event to start
recording the time spend.

This was causing the `events/duratin_in_millis` to not be in sync with
the time spend on the filtera, since `take_batch` was called in a tight
loop and could return an empty array this made the duration was way off.

Fixes: #5952

Fixes #5953
2016-09-20 20:08:42 -04:00
Pier-Hugues Pellerin
f0ae34e25a Fix a concurrency issue with the Webserver when overrideing Puma STDERR and STDOUT.
This PR changes how we modify the STDOUT/STDERR in puma, instande of
using `const_set`, we override the constants using a module.
This operation should be thread safe and will make sure the STDERR are
correctly visible.

After when we receive the logger we can swap the null logger with the
real thing in a thread safe way.

Fixes: #5912

Fixes #5918
2016-09-16 10:55:53 -04:00
Pere Urbon-Bayes
0daeec7e04 fix logstash-core show version method to use proper logger info checks
Fixes #5927
2016-09-15 13:04:36 -04:00
Tal Levy
b072d93c85 fix tests and bring back configure logging in runner
Fixes #5901
2016-09-13 17:08:35 -04:00
Tal Levy
63233b1cf1 respect log.format and path.logs from cli
also change how `log.level` is configured at startup time to be set
as a property directly in the log4j2.properties file

Fixes #5900
2016-09-13 16:45:30 -04:00
Tal Levy
2cf53cedf5 Set default log.level to INFO
sets default to INFO and updates some verbose logging to
more appropriate, less verbose log levels where it makes sense.

Closes #5735.
Closes #5893.

Fixes #5898
2016-09-13 16:43:20 -04:00
Pier-Hugues Pellerin
70646ad5b0 Return 404 on non existant resources
This PR introduce a changes to make sure the API endpoint correctly
return 404 in every case. To make it work it uses an exception that get
pickup up in the base class by the `error` handler.

Using the exception template allow the code to be dry and make sure all
other errors can be returned with the same format.

Example or a 404.
```json
{
"error": { "message": "Not Found"},
"path": "/this-should-not-exist"
"status": 404
}
```

The code will also set the content-type and the right error code in the
header.

Fixes: #5874, #5622

Fixes #5897
2016-09-13 14:15:16 -04:00
Tal Levy
79e7daf746 add logging api endpoint
PUT /_nodes/logging -- sets log levels
GET /_nodes/logging -- retrieves log levels of existing loggers

Fixes #5871
2016-09-13 03:46:28 -04:00
Tal Levy
61ebeb0b4b update path.log to path.logs directory, and respect it in log4j2
Fixes #5876
2016-09-08 18:06:30 -04:00