Commit graph

67 commits

Author SHA1 Message Date
Jake Landis
ce3ec9b9ee test fix: use single worker in test to avoid concurrency issue in sleep filter
See: https://github.com/elastic/logstash/issues/8073
See: https://github.com/logstash-plugins/logstash-filter-sleep/issues/7

Fixes: #8974

Fixes #8975
2018-01-17 18:07:53 +00:00
Jake Landis
3a663df23b test fix: don't use stdin for blocking pipeline
Fixes #8961
2018-01-17 14:53:42 +00:00
Jake Landis
30a37fda97 Rspec integration tests for secret store
Fixes #8944
2018-01-16 16:46:42 +00:00
Dan Hermann
9ff894ff06 Support setting logging back to defaults via the API.
Fixes #8384

Fixes #8786
2017-12-01 23:09:05 +00:00
Jake Landis
f55c32b08c Test fix: Allow slowlog to have >= 1 entries, instead of exactly 2 entries.
Fixes #8322

Fixes #8323
2017-09-19 21:54:45 +00:00
Jake Landis
bc4f57cd02 Test fix: ensure 'fatal: Not a git repository' is not picked up as expectation integration test Fixes #8319
Fixes #8320
2017-09-19 19:57:53 +00:00
Jake Landis
1340f2eee0 Introduce docker for CI builds.
This commit includes:
* A base Dockerfile and script to push to a Docker repo
* A per-build Dockerfile (derived from the base)
* Updates to the test scripts to allow for more parallel builds
* Docker wrappers for the tests scripts
* Update for the integration test readme to manually run the tests
* Clean up the output of the Java tests
* Remove offline tag for tests (no longer needed that we don't use docker dependent services)

This commit does NOT include:
* Changes needed for the CI system to use Docker

Fixes #8223
2017-09-14 18:55:41 +00:00
Rob Bavey
462e9c368f Remove wait for client sleep
Fixes #8175
2017-09-13 12:53:34 +00:00
Rob Bavey
1675eb3a0f Handle Elasticsearch errors better during DLQ integration tests
Give more time for Elasticsearch to start up, and retry after
503 responses

Fixes #8175
2017-09-13 12:53:34 +00:00
Armin
734a443aac MINOR: Exclude JAVA_OPT* line from matching in prepare_offline_pack_spec
Fixes #8182
2017-09-08 12:59:48 +00:00
Rob Bavey
f75f8579bd DLQ Integration Test stabilization
Attempt to stabilize DLQ Integration tests
 - Only tear down ES instance once tests are complete
 - Delete indices after each test
 - Tear down Logstash after each test

Fixes #8143
2017-09-06 01:02:06 +00:00
Rob Bavey
ca8775e35e DLQ integration test improvements
Added single pipeline tests

Fixes #8026
2017-09-01 19:45:13 +00:00
Rob Bavey
f3843e7414 Add multi-pipeline test
Needs DRY-ing up before commit, but tests should be valid

Fixes #8026
2017-09-01 19:45:12 +00:00
Rob Bavey
ee1b5420ed RATS: Dead Letter Queue integration tests (WIP)
Simple test for dead letter queue integration tests:
  Attempt to write invalid entries to elastic search, fail and
  remove invalid field. Verify that mutated entry exists in es

Not for committing - has different jvm.options to improve stability
  to ensure that the tests pass in CI.

Fixes #7882

Fixes #8026
2017-09-01 19:45:12 +00:00
Rob Bavey
2f332d9388 DeadLetterQueueReader should handle missing segment files at startup
Change DeadLetterQueueReader, so that if a missing segment file is
encountered at startup, the next valid entry will be used instead

Fixes #7433

Fixes #7457
2017-08-14 20:07:46 +00:00
Armin
0c3a58c172 MINOR: Enable JRuby AOT compilation and turn JIT threshold down to 0
Fixes #7783
2017-07-24 21:34:41 +00:00
João Duarte
7579f96797 test multiple pipelines using RATS (#7732)
- also adds `config.support_escapes` do list of pipeline settings
2017-07-19 16:43:56 +01:00
Jake Landis
3a6902c2f3 Bug Fix: Log messages from Java code base
This change re-configures default instead of creating a new context.

Fixes #7526

Fixes #7528
2017-07-06 16:53:08 +00:00
Pier-Hugues Pellerin
76286b4f0e use jruby 9.1.9.0
Work done by @guyboertje and @ph

Since JRuby 1.7.25 is now EOL we are migrating Logstash to use JRuby 9k and JDK8 only,
Not much needed updating to make this work, its was mostly a drop in replacement from the previous version.

The major point was the change in the implementation of Time in JRuby, JRuby now use `java.time`
instead of joda time, this allow JRuby to have nanoseconds precision on time object.
2017-06-12 12:35:10 -04:00
Rob Bavey
2d2cee4d2e Add Metrics for dead letter queue
Add an initial set of metrics for the dead letter queue.

Metrics are supplied under the pipeline in the following format:

"dead_letter_queue": {
        "queue_size_in_bytes": ...,
      }

Metrics are populated via a PeriodicPoller

Also fixed up calculation of currentQueueSize to take account
of version headers, which was previously being skipped.

Additionally, whether the dlq is enabled, and if so, the path
of the dlq is supplied under the pipelines API endpoint

Resolves #7287

Fixes #7338
2017-06-09 17:14:18 +00:00
Jake Landis
5b4a725a36 Fix #7277 Review updates
Fixes #7321
2017-06-09 14:56:40 +00:00
Jake Landis
55979c3a07 Bug Fix: Fix ability to change log level via the API
The ability to change the log level as described at https://www.elastic.co/guide/en/logstash/current/logging.html#_logging_apis appears to no longer work. The root cause of this issue is that log4j2 context we initialize is different from the log4j2 context that we are setting via the API. The fix here is to mirror the functionality of org.apache.logging.log4j.core.config.Configurator.setLevel Java method, but instead use the logging_context initialized in our code via JRuby.

Fixes #7277

Fixes #7321
2017-06-09 14:56:40 +00:00
Joao Duarte
bed8b8a084 support multiple pipelines in one logstash instance
* add multi_local source for multi pipelines
* introduce pipelines.yml
* introduce PipelineSettings class
* support reloading of pipeline parameters
* fix pipeline api call for _node/pipelines
* inform user pipelines.yml is ignored if -e or -f is enabled
2017-05-30 09:47:53 +01:00
Andrew Cholakian
bb60eb8f47 Run offline specs separately from online ones.
The internet disabling C hack can break other tests, so, we now run
those tests separately.

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

Fixes #7179
2017-05-22 15:28:27 +00:00
Joao Duarte
412dd7bc08 add ExpectationNotMetError to Stud.try on monitoring_api_spec
in some tests against metrics api it's possible the values aren't there,
making the assertion fail. By default Stud.try only catches StandardError,
but rspec throws a RSpec::Expectations::ExpectationNotMetError on a failed
assertion, and this exception inherits directly from Exception.

This commit explicitly adds this exception to the list of Stud.try exceptions

Fixes #7177
2017-05-22 13:46:30 +00:00
Joao Duarte
c3df20b7cf protect monitoring_api_spec against timing issues
Fixes #7145
2017-05-21 18:52:14 +00:00
Joao Duarte
8b2490bad8 fix failing test due to faulty api request
fixes https://github.com/elastic/logstash/issues/7086

Fixes #7144
2017-05-18 11:00:27 +00:00
Pier-Hugues Pellerin
90432f5265 Relax the Geoip filter test
Since the database of the plugin can be update we cannot do a strict
assert on the geoip lat/long values instead we will use a range of
possible and valid latitude and longitude.

Fixes: #7119

Fixes #7122
2017-05-16 17:36:33 +00:00
Armin
2ac72226d3 #7091 Dockerized Kafka IT fixture
Fixes #7093
2017-05-13 22:46:24 +00:00
Joao Duarte
b7f4f9d649 fix remaining race condition in monitoring api integration spec
* add NoMethodError to list of allowed exceptions in try
2017-05-11 18:25:13 +01:00
Joao Duarte
838f593d1a fix monitoring api integration race condition
because the metric subsystem may not be ready yet when the tests ask for
the values, the test code may generate a NoMethodError accessing nested
hashes.

The NoMethodError exception aborts the try mechanism instead of retrying.

This PR rescues potential exceptions and adds more expectations to
protect the try block.

Fixes #7074
2017-05-11 13:06:58 +00:00
Joao Duarte
2b7b8f0d81 make integration specs a bit more resilient
* wait for logstash starting in monitoring_api integration tests
* remove initialization code from monitoring api integration spec
2017-05-11 10:24:57 +01:00
João Duarte
07194b830f make e and f flags mutually exclusive (#6976) 2017-05-09 16:42:32 +01:00
Wainer dos Santos Moschetta
6b282234cb ci: fix run single specs
Some integration spec tests fail to run
individually due missing require modules.

This fix it by ensuring all specs and helpers
require the needed modules.

Fixes #7037

Fixes #7038
2017-05-06 01:30:33 +00:00
Pier-Hugues Pellerin
4344e4b613 Allow Logstash to accept a PROXY configuration
Logstash's plugin manager will now follow proxy configuration from the environment.
If you configure `http_proxy` and `https_proxy`, the manager will now use theses information for all the ruby http
connection and will also pass that information down to maven.

Fixes: #6619, #6528

Fixes #6825
2017-03-31 14:20:38 -04:00
Josh Soref
a06dc211ff Spelling fixes (#6806)
Spelling fixes across the board.
2017-03-29 19:33:26 -07:00
Joao Duarte
4981cf878c introduce locking in path.data
Fixes #6738
2017-02-24 05:27:09 -05:00
Pier-Hugues Pellerin
be702a9159 Fix the multiple instance on the same machine test for when running under the PQ
This PR make the smoke test for the multiple instances of logstash works
and also change the assertions of a few tests to make it more robust.

Instead of a `try` I assert the creation of a file generated by a fixed generator.

Fixes: #6707

Fixes #6709
2017-02-15 13:07:41 -05:00
Pier-Hugues Pellerin
b3906c89cd Allow to run the bin/logstash-plugin install <pack> outside of the Logstash directory
Fixes: #6599

Fixes #6602
2017-01-31 13:15:41 -05:00
Tal Levy
641b855127 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
Pier-Hugues Pellerin
fdda39964d Add bin/logstash-plugin prepare-offline-pack command
This new command replace the old workflow of `pack`, `unpack` and the `install --local`, and wrap all the logic into one uniform way of installing plugins.
The work is based on the flow developed for installing an x-pack inside Logstash, when you call prepare-offline-pack, the specified plugins and their dependencies will be packaged in a zip.
And this zip can be installed with the same flow as the pack.

Definition:

Source Logstash: Where you run the prepare-offline-pack.
Target Logstash: Where you install the offline package.

PROS:
- If you install a .gem in the source logstash, the .gem and his dependencies will be bundled.
- The install flow doesn't need to have access to the internet.
- Nothing special need to be setup in the target logstash environment.

CONS:
- The is one minor drawback, the plugins need to have their JARS bundled with them for this flow to work, this is currently the case for all the official plugins.
- The source Logstash need to have access to the internet when you install plugins before packaging them.

Usage examples:
bin/logstash-plugin prepare-offline-pack logstash-input-beats
bin/logstash-plugin prepare-offline-pack logstash-filter-jdbc logstash-input-beats
bin/logstash-plugin prepare-offline-pack logstash-filter-*
bin/logstash-plugin prepare-offline-pack logstash-filter-* logstash-input-beats

How to install:
bin/logstash-plugin install file:///tmp/logstash-offline-plugins-XXXX.zip

Fixes #6404
2017-01-03 13:59:49 -05:00
Tal Levy
2b45a9b4ae 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:14:47 -08:00
Suyog Rao
c8826b81ab Add reload stats at the instance level
Reload stats are currently reported at the pipeline level. The instance
level aggregates these stats across the pipelines

Fixes #6350

Fixes #6367
2016-12-13 00:59:24 -05:00
Suyog Rao
0687f6821a Add feature flag support for RATS (#6328)
* Add feature flag support for RATS

Adds feature flag support for RATS integration tests. First feature to use it
is persistent_queues. You can enable a FF in travis by using the travis matrix
and adding a env variable called FEATURE_FLAG=<feature_name>.

To use feature flag, you need a logstash.yml file which has this feature turned on.
Unfortunately --path.settings needs an entire dir where logstash.yml is located, not
just the logstash.yml file, so we need to checkin the fixture which has the feature yml
and log4j.

For example, you can now set FEATURE_FLAG=persistent_queues which means travis will
run tests twice, one with this feature enabled and once without it. When the feature is enaabled
the logstash.yml located in qa/integration/fixtures/persistent_queues is picked up whenever LS is started in tests
2016-12-01 11:29:16 -08:00
Pier-Hugues Pellerin
81e8bda0b9 use a temporary path instead of a temporary file
Using an empty file for the regitry make FB quits with a EOF error

Fixes: #6285

Fixes #6286
2016-11-21 20:10:53 -05:00
Pier-Hugues Pellerin
12cfa69215 Feature: A way to install/remove a plugin pack
A pack in this context is a *bundle* of plugins that can be distributed outside of rubygems; it is similar to what ES and kibana are doing, and
the user interface is modeled after them. See https://www.elastic.co/downloads/x-pack

**Do not mix it with the `bin/logstash-plugin pack/unpack` command.**

- it contains one or more plugins that need to be installed
- it is self-contains with the gems and the needed jars
- it is distributed as a zip file
- the file structure needs to follow some rules.

- As a reserved name name on elastic.co download http server
    - `bin/plugin install logstash-mypack` will check on the download server if a pack for the current specific logstash version exist and it will be downloaded, if it doesn't exist we fallback on rubygems.
    - The file on the server will follow this convention `logstash-mypack-{LOGSTASH_VERSION}.zip`

- As a fully qualified url
    - `bin/plugin install http://test.abc/logstash-mypack.zip`, if it exists it will be downloaded and installed if it does not we raise an error.

- As a local file
    - `bin/plugin install file:///tmp/logstash-mypack.zip`, if it exists it will be installed

Fixes #6168
2016-11-17 14:00:02 -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
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
Tal Levy
19d3232873 slowlog
Fixes #6128
2016-11-02 18:48:40 -04:00