Commit graph

330 commits

Author SHA1 Message Date
Pier-Hugues Pellerin
6f9fb96818 Refactor non_reloadable_plugin
Instead of using a list of non reloadable plugin we add a new class
method on the base plugin class that the plugin will override.

By default we assume that all plugins are reloadable, only the stdin
shouldn't be reloadable.

Fixes #6499
2017-01-25 08:55:46 -05:00
Joao Duarte
0d47a362d0 fix return value of start_pipeline when start_workers fails
during Agent#start_pipeline a new thread is launched that executes
a pipeline.run and a rescue block which increments the failed reload counter

After launching the thread, the parent thread will wait for the pipeline
to start, or detect that the pipeline aborted, or sleep and check again.

There is a bug that, if the pipeline.run aborts during start_workers,
the pipeline is still marked as `ready`, and the thread will continue
running for a very short period of time, incrementing the failed reload
metric.

During this period of `pipeline.ready? == true` and `thread.alive? == true`,
the parent check code will observe all the necessary conditions to
consider the pipeline.run to be succesful and thus increment the success
counter too. This failed reload can then result in both the success and
failure reload count being incremented.

This commit changes the parent thread check to use `pipeline.running?`
instead of `pipeline.ready?` which is the next logical state transition,
and ensures it is only true if `start_workers` runs successfuly.

Fixes #6566
2017-01-20 06:47:14 -05:00
Joao Duarte
705ad54443 improve user facing error when yaml is incorrect
Fixes #6546
2017-01-19 12:14:21 -05:00
Pier-Hugues Pellerin
fdc4c15e46 review comments
Fixes #6498
2017-01-16 12:28:37 -05:00
Pier-Hugues Pellerin
8e57042e25 Extract the creation of the queue into a factory
I've move the initialization code into a factory for future work on the
pipeline.

Fixes #6498
2017-01-16 12:28:37 -05:00
Suyog Rao
c9391e964e Renamed cgroups metric to number_of_elapsed_periods
Renamed number_of_periods to number_of_elapsed_periods to be consistent with ES.

Fixes #6536
2017-01-16 12:20:16 -05:00
Tal Levy
bca87bae40 remove current_size_in_bytes and acked info from node stats
re #6508.

- removed `acked_count`, `unacked_count`, and migrated `unread_count` to
top-level `events` field.
- removed `current_size_in_bytes` info from queue node stats

Fixes #6510
2017-01-09 19:19:28 -05:00
Suyog Rao
9fc093e484 Bump version to 5.3.0 for 5.x branch (#6483) 2017-01-04 08:54:42 -08:00
Mykola Shestopal
4c4330ec2f Fixed calculation of took_in_millis for #6476
Fixes #6481
2017-01-04 11:43:56 -05:00
Colin Surprenant
8c4d8b83fc avoid resetting inexisting tags field back to empty array plus specs
Fixes #6477
2017-01-03 22:31:31 -05:00
Pier-Hugues Pellerin
94a67cb4e0 Record the execution time for each output in the pipeline
Record the wall clock time for each output a new `duration_in_millis`
key will now be available for each output in the api located at http://localhost:9600/_node/stats

This commit also change some expectations in the output_delegator_spec
that were not working as intended with the `have_received` matcher.

Fixes #6458
2016-12-29 12:51:41 -05:00
Pier-Hugues Pellerin
7715fabdc2 Initialize the metric values in the batch to the correct type
When we were initilizing the `duration_in_millis` in the the batch we
were using a `Gauge` instead of a counter, since all the object have the
same signature when the were actually recording the time the value was
replaced instead of incremented.

Fixes #6465
2016-12-29 11:12:32 -05:00
Pier-Hugues Pellerin
6250974508 Code cleanup for the collector observer
We have more the responsability of watching the collector inside the
input itself, this feature might come back when we have a new execution
model that can be improved in watching metrics. But this would require
more granular watchers.

No tests were affected by this changes since the code that required that
features was already removed.

Fixes: #6447

Fixes #6456
2016-12-29 08:59:52 -05:00
Pier-Hugues Pellerin
cc5b283035 Do not log a warning if a plugin is not from in #print_notice_version
When a plugin is loaded using the `plugins.path` option or is from a
universal plugin there no gemspec can be found for the specific plugin.

We should not print any warning on that case.

Fixes: #6444

Fixes #6448
2016-12-21 09:44:37 -05:00
Pier-Hugues Pellerin
ad763c81a3 Initialize with default values global events and pipeline events related metric
The metric store has no concept is a metric need to exist so as a rule
of thumb we need to defined them with 0 values and send them to the
store when we initialize something.

This PR make sure the batch object is recording the right default values

Fixes: #6449

Fixes #6450
2016-12-21 09:43:29 -05:00
Joao Duarte
90c364e903 ensure metric collection is disabled when metric.collect is false
Fixes #6445
2016-12-21 07:20:23 -05:00
Joao Duarte
a9e474f0e1 add tests for webserver metric
Fixes #6385
2016-12-19 12:43:25 -05:00
Joao Duarte
b314800abc add webserver metric
Fixes #6385
2016-12-19 12:43:25 -05:00
Pier-Hugues Pellerin
f0ab5fd955 rename cgroup usage to usage_nanos to align with ES' api
Fixes #6428
2016-12-16 10:19:59 -05:00
Tal Levy
f8b4c72a49 add queue stats to node/stats api (#6331)
* add queue stats to node/stats api

example queue section:

```
"queue" : {
    "type" : "persisted",
    "capacity" : {
      "page_capacity_in_bytes" : 262144000,
      "max_queue_size_in_bytes" : 1073741824,
      "max_unread_events" : 0
    },
    "data" : {
      "free_space_in_bytes" : 33851523072,
      "current_size_in_bytes" : 262144000,
      "storage_type" : "hfs",
      "path" : "/logstash/data/queue"
    },
    "events" : {
      "acked_count" : 0,
      "unread_count" : 0,
      "unacked_count" : 0
    }
}
```

Closes #6182.

* migrate to use period metric pollers for storing queue stats per pipeline
2016-12-15 13:19:08 -08:00
Pier-Hugues Pellerin
a611ebf64f Add cgroup information to the api
When logstash is run under a linux container we will gather statistic about the cgroup and the
cpu usage. This information will should in the /_node/stats api and the result will look like this:

```
  "os" : {
    "cgroup" : {
      "cpuacct" : {
        "usage" : 789470280230,
        "control_group" : "/user.slice/user-1000.slice"
      },
      "cpu" : {
        "cfs_quota_micros" : -1,
        "control_group" : "/user.slice/user-1000.slice",
        "stat" : {
          "number_of_times_throttled" : 0,
          "time_throttled_nanos" : 0,
          "number_of_periods" : 0
        },
        "cfs_period_micros" : 100000
      }
    }
  }
```

Fixes: #6252

Fixes #6357
2016-12-15 15:46:38 -05:00
Jordan Sissel
69c3bc21d4 Remove unnecessary log4j-1.2-api depedency.
This library provides a "log4j 1.2"-like API from the log4j2 library.

We don't seem to use this, and including it seems to be the cause of the
Logstash log4j input rejecting log4j 1.x's SocketAppender with this
message:

    org.apache.log4j.spi.LoggingEvent; class invalid for deserialization

The origin of this error is that log4j2's log4j-1.2-api defines
LoggingEvent without `implements Serializable`.

This commit also includes regenerated gemspec_jars.rb and
logstash-core_jars.rb.

Reference: https://github.com/logstash-plugins/logstash-input-log4j/issues/36

Fixes #6309
2016-12-14 02:19:57 -05:00
Suyog Rao
564bb7d41e Expose stats the right way
Fixes #6367
2016-12-13 00:59:24 -05:00
Pier-Hugues Pellerin
37fc21c2dc Do not include Utils, this could cause some bad references on the LogStash::Environment in the context of stand alone gems
Fixes #6377
2016-12-08 15:00:55 -05:00
Guy Boertje
23df3d1506 Allow for exception instances to get serialized in JSON logging 2016-11-30 15:45:45 -08:00
Joao Duarte
265d45f3ce rename queueMaxSizeInBytes to queueMaxBytes and currentSize to currentByteSize
Fixes #6297
2016-11-29 05:10:43 -05:00
Joao Duarte
ce608b0921 add ruby wiring to the queue.max_size setting
Fixes #6297
2016-11-29 05:10:43 -05:00
Joao Duarte
3b82211e0c update version to 5.2.0
Fixes #6294
2016-11-24 06:01:29 -05:00
Colin Surprenant
38fc84b367 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 15:55:32 -05:00
Andrew Cholakian
f66145a596 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 14:42:44 -05:00
Pier-Hugues Pellerin
36a6e444d7 Theses core input are not currently used inside logstash so it make sense to remove them
Fixes #6268
2016-11-17 11:54:34 -05:00
Tal Levy
329b6a4ff1 add logstash-core resources to classpath during development
Fixes #6235.

Fixes #6237
2016-11-16 08:50:47 -05:00
Pier-Hugues Pellerin
e32c8efdce 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
9c9b4a42bb 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:39 -05:00
Suyog Rao
5b21ca10ff shutdown after spec
Fixes #6236
2016-11-11 11:52:19 -05:00
Suyog Rao
26bf1e4f21 Add JVM uptime stats
Fixes #6236
2016-11-11 11:52:19 -05:00
Suyog Rao
6f77dc4047 Add uptime millis stats
Fixes #6236
2016-11-11 11:52:19 -05:00
Pier-Hugues Pellerin
21c435a5b3 bad merge
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
84a747cdfe 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
f86f1377cc Chagne PluginRegistry -> PLUGIN_REGISTRY
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
e85f31962e fixes from reviews from @joao
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
9ee34a3c6f adjust the specs
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
202221edc1 fixing the tests
Fixes #6109
2016-11-11 09:43:44 -05:00
Pier-Hugues Pellerin
ab89a90a4c 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:44 -05:00
Joao Duarte
4e75d4dc60 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
efefe7f32a 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
e0ea02b045 fix tagging edge cases
add comment and use Arrays.asList()

brain fart between camelCase and snake_case
2016-11-04 14:13:13 -04:00
Tal Levy
6eef09de32 slowlog
Fixes #6128
2016-11-02 18:48:40 -04:00
Suyog Rao
53f7a64ccb Use stderr instead of puts
Fixes #6172
2016-11-02 15:52:00 -04:00
Suyog Rao
22374fdefc 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