Commit graph

766 commits

Author SHA1 Message Date
Pere Urbon-Bayes
1cbe1791d1 add the concept of a jar manager to load jars within plugins
make the jar manager to have some of the checks already present in the old load_elasticsearch_jars

removed the load_elasticsearch_jars! method as it's a legacy code from when ES was delivered within LS, nowadays this comes within the differents plugins

clean up Environment::JAR_DIR as is another legacy variable not used anymore

move the jar loading code within the environment module

ammend previous commit adding more clear code

ammend previous commits

added a few simple unit test for the jar manager in the environment module

refactor spec naming

dry out common code for loading jars

clean up env_spec bein in the util dir

cleaning up logstash-core dependencies related to jar-dependencies

ammend stale maen patches created for the LS way of using maven plugins

applied some comments coming from the review by @ph

bring back the maven tools and jar-dependency code as we still need some code like this for the kafka plugins

Revert "bring back the maven tools and jar-dependency code as we still need some code like this for the kafka plugins"

This reverts commit c23f456362776c0a600d78369c2ece8789fa49c2.

Fixes #2980
2015-04-14 15:59:31 +00:00
Tal Levy
2c8802710b Fixes Event#include? to properly check for field
Beforehand, Event#include? would depend on a value of a certain
field to be non-nil as the signal that a field exists. This breaks
when a field's value is nil, even if the field exists. It is now
possible to check for existance of both normal and metadata fields.

Closes #2977.

Fixes #2997
2015-04-13 21:54:41 +00:00
Pier-Hugues Pellerin
96b6893ebc Allow the installation of a plugin from a .gem, refactor the plugin manager classes.
do not change the gemfile or the .lock

Fixes #2946
2015-04-09 13:52:05 +00:00
Colin Surprenant
dbe4154aa6 1.5 pipeline performance regressions fixes
rework output function init

removed double logger.debug

use event constant

fix LogStash::SHUTDOWN to actually be the shutdown signal event push in the pipeline

fix outputs conditionals handling

code gen methods not lambdas, remove intermediate arrays, base multi_filter to simplify code gen

remove block from filter_func

force_encoding at compile time

commented multi_filter method

typo

DRY & cleanups

optimizations: string constants, timestamp initialization, useless logger instance

specs for signal events

Filters::Base interface and multi_filter method

closes #2870

Fixes #2869
2015-03-30 20:07:58 +00:00
Joao Duarte
e5ba35e0c7 test output plugin vs worker params
Fixes #2876
2015-03-24 21:06:10 +00:00
Tal Levy
203d1e5fc7 raise error when formatting time without @timestamp field
Closes #2730

Fixes #2736
2015-03-09 22:57:39 +00:00
Tal Levy
9a4bcf1f10 do not wrap existing Password type into another Password type when validating
Fixes #2767
2015-03-04 22:29:08 +00:00
Pier-Hugues Pellerin
de27d9f0a0 Use warn level instead of error level when a plugin is using the milestone method in the plugin
Fixes #2735
2015-03-03 00:19:13 +00:00
Pier-Hugues Pellerin
786d2d2c1a Fallback to a local configuration if the parsing for remote configuration fails
Fixes #2653
2015-02-23 15:46:09 +00:00
Aaron Mildenstein
8d57eac33e Missed a spec...
Fixes #2661
2015-02-20 22:53:18 +00:00
Aaron Mildenstein
3986158bac First pass at cleaning out logstash web
All internal references, flags, kibana, vendor, everything must go!

If it referenced kibana or logstash-web, it is deprecated, and removed!

Operators are standing by...

Fixes #2661
2015-02-20 22:53:18 +00:00
Pier-Hugues Pellerin
9e7d6204a5 plugins/bundler refactor
squashed 113 commits by @ph, @colinsurprenant, @jordansissel, @purbon, @jsvd

cleaning the environment.rb

initial work

remove multiples polyglot

force to load rubygems

notice

point to one config

update lock

bootstrap will package the standard application until we have the plugin manager on top of the gemfile

add the gem path to find bundler

fixing dependencies

add gemfiles and bundle

comment platform requiremments in the gemfile

Set `Gem.paths = ...` to the GEM_HOME

Without this, `bin/logstash` will error:

    LoadError: no such file to load -- bundler
         require at org/jruby/RubyKernel.java:1071
         require at C:/Users/jls/Documents/GitHub/logstash/vendor/jruby/lib/ruby/shared/rubygems/core_ext/kernel_require
.rb:55
         set_gem_paths! at C:/Users/jls/Documents/GitHub/logstash/lib/logstash/environment.rb:64
         (root) at C:\Users\jls\Documents\GitHub\logstash\lib\logstash\runner.rb:8

Patch JRuby's jar_installer.rb with a newer version

jar-dependencies is shipped by default with JRuby. However, the version
it ships with has a bug, and despite upgrading jar-dependencies to
0.1.7, which has the fix, JRuby continues to load the "shipped" version
which has a bug.

This patch will patch JRuby by copying in our own jar_installer.rb from
jar-dependencies master, This patching occurs while unpacking JRuby just
after `vendor:jruby`.

The jar_installer.rb is MIT-licensed and no changes were made.

Add `test:plugins` to test all installed plugins

Tell rspec to do the wildcards instead of trying to make the shell do it.

This fixes test runs on Windows (which doesn't do wildcards like this).
The solution was to tell RSpec to look for all files matching a certain path pattern
within the GEM_HOME.

do not run bundle install twice for test:plugins

Gemfile manipulation classes

Gemfile now in root

install POC with new Gemfile classes

specs for the Gemfile classes

header, some bug fixes

spec header

WIP pluginmanager refactor

generated format

updated .lock

unused file

removed --proxy option

fail elegantly

initial support for update

refactor invoke_bundler, debug output

removed old .lock file

no plugin Gemfile

use clamp error handling

reenable list, some cleanups

support for more finders

refactored using new finders

refactor using is_installed_plugin? and some cleanups

verify valid plugin and update all now only update plugins not all gems

support multiple plugins argument, --force option to bypass validation

list only explicitly installed plugins by default, --all option to include dependencies

support multiple plugins argument

renamed all_installed_plugins to all_installed_plugins_gem_specs and return specs, added comments

remove then

update_gem bug, comments

moved gems as development dependencies

updated .lock file

support for :without

--development option, better output feedback, cleanups

abort when no plugins

cosmetic

param fix, cleanups

removed deprecated .lock files

remove deprecated bundler_install_command and struggling with set_gem_paths

refactored all bundler stuff into LogStash::Bundler

rakelib refactor

refactored bundler code

Bundler.real_fuckin_reset

real_fuckin_reset is now reset_settings, removed unnecessary resetings, cleanups

duplicate plugins requirements merging

cleanups

added vendor:rake, cleanups

broke test tasks into 2 steps, first invoke install then test

rake task name fix

proper error exit code

Freezing the jar-dependencies, ruby-maven, tools

set gem paths on error

renamed TEST_PLUGINS to CORE_PLUGINS, added comments

replace test by core, cleanups

DRYied test tasks

missing gemspec

fixed output

correct image build for artifacts

removed deprecated Gemfiles

fix update with multiple plugins arguments

fix update with multiple plugins arguments

remove deprecated code

implicit begin, explicit block

spec for LogStash::Bundler

remove explit require of rubygems

renamed Environment.set_gem_paths! to bundler_setup!

rename Dsl to DSL

respect to_s contract and return empty string not nil

rename DSL.parse gemfile argument to gemfile_content

better error message

renamed --force to --[no-]verify

refactored exit error handling

use explicit array items in iterators

fix --development switch validation, cleaned bundler_options hash init

renamed is_xxx? methods to xxx?

use direct method call on collection

removed double negative, typo

move maven tools monkey patch into maven_tools_patch.rb

renamed build-image to prepare

fix forgotten argument name change

namespace cleanups

spec files glob pattern

cleanup

cleanup

cleanup

Fix the file-dependencies version to 0.1.5 to fix path issues on windows

monkeypatch Rubygems to silence ffi warning

list all plugin gems by default, new options

adding rake task to get faster feedback loop on windows

refactor bat scripts

Use an unreleased filedependencies gem and skip installing drupal

bump file-dependencies

use the released gem of file-dependencies

Add a set of scripts that simplify:   * The necessary setup for the CI test to be executed.   * The actuall CI test execution, having a different scripts for each     different workflow. This makes the test execution simpler and standard, so changes in internal task don't need big changes in the CI config. It also documents and makes easy for developers to run the tests.

Fixes #2640

refactored test to not depend on STDOUT

create a .rspec file to pass some options used while the code is in the testing environment

add coveralls and simplecov as a development dependencies so we can run coverage tests

remove unnecessary .bundle directory from the artifact

In a release, the .bundle/config has a BUNDLE_PATH setting that can
interfere by misleading the plugin manager into not seeing the
vendor/bundle path.

Fixes #2647

Fixes #2475
2015-02-20 17:31:43 +00:00
Pier-Hugues Pellerin
890c1bc3eb Use the .info level when printing the version notice for the plugin
Fixes #2429
2015-01-27 17:40:38 +00:00
Pere Urbon-Bayes
5e689dad9c cleanup unused require references as they are required by the devutils spec_helper
mock the coverage report from devutils into the general spec helper

Revert "mock the coverage report from devutils into the general spec helper"

This reverts commit 4c7e265e302b9e9450a44469ac571ad39fb7d433.

Fixes #2412
2015-01-27 12:15:31 +00:00
Pere Urbon-Bayes
b53e2e8aed enabled coverage report again throw installing missing dependencies when the user run rake test:prep, user should use COVERAGE=true as before
Fixes #2412
2015-01-27 12:15:31 +00:00
Suyog Rao
46e96fb0a2 Added specs for accessors del method
Fixes #2384
2015-01-22 17:26:04 +00:00
Pier-Hugues Pellerin
07f7882ccf fix merge conflicts
Fixes #2280
2015-01-21 22:08:11 +00:00
Tal Levy
c3bab9d896 add support for :bytes validation to config
Fixes #2321
2015-01-15 19:53:31 +00:00
Pier-Hugues Pellerin
2d7ebd1999 add a check if we can't find the version
Fixes #2331
2015-01-14 23:46:00 +00:00
Pier-Hugues Pellerin
938dbfca77 Refactoring of the version check using comparable
Fixes #2331
2015-01-14 23:46:00 +00:00
Pier-Hugues Pellerin
4d7549f5f7 create a class to hold the plugin version
Fixes #2331
2015-01-14 23:46:00 +00:00
Pier-Hugues Pellerin
49f03efc19 adding a test for deprecating the milestone method
Fixes #2331
2015-01-14 23:46:00 +00:00
Pier-Hugues Pellerin
f340a359ef Use the gem specification from the plugin to display the version notice to the user
Fixes #2331
2015-01-14 23:46:00 +00:00
wiibaa
d86797dea9 harmonized event filtering by type/tags in filter and output + correct logging
Fixes #2339
2015-01-12 18:17:44 +00:00
Pere Urbon-Bayes
87aea97f49 Removed insist from logstash-event gemspec and also removed the jar_spec as it's no longer needed
Fixes #2319
2015-01-07 16:56:59 +00:00
Pere Urbon-Bayes
45b39d6cb6 refactor insist usage as a dependency
Fixes #2319
2015-01-07 16:56:59 +00:00
Colin Surprenant
e34aee2bff Plugin#lookup refactor to resolve plugin classes in the namespace, added plugin spec and filter base class spec
refactor Plugin#lookup to resolve existing plugin class in the namespace but not in the plugins path

ex noop filter specs refactored into a filter base_spec

reverted locales/en.yml changes

plugin lookup logic refactor

fix the new spec_helper location

check if class in a LogStash::Plugin

add debug log

typo

test for plugin class and config_name method

replaced :file with :path

use Class.new and cosmetic changes

Fixes #2095
2015-01-06 20:01:20 +00:00
Tal Levy
b7ba48d393 update accessors#get does not mutate @store
This fixes Accessors so that when one `get`s a
field reference, it does not inject an empty path
into the original store

before, there were side-effects:
data = {}
a = LogStash::Util::Accessors.new(data)
a.get("[hello][world]")
//(data mutates) data == {"hello" => {}}

Fixes #2294
2014-12-30 09:22:59 +00:00
Tal Levy
d6cb066e03 update pipeline to call teardown of output workers when :workers > 1
Fixes #2180
2014-12-26 12:41:51 +00:00
Pier-Hugues Pellerin
fcd50f0cb5 add test to sprintf to cover metadata support
Fixes #2149
2014-12-01 19:32:41 +00:00
Jordan Sissel
90da82b8b7 Use logstash-devutils
Fixes #2117
2014-11-21 20:43:25 +00:00
Colin Surprenant
1a095fccb9 fix removing field with reference to array items & specs
Fixes #1990
2014-11-18 19:19:04 +00:00
Tal Levy
dd3667e08f Fix for handling accessor sets on array elements.
Previously: Filters like mutate would throw an exception when attempting
to convert an element within an array to a specific type. This was
raising an error because the index in the field reference was being
treated as a String instead of an integer representing the index of the
field to convert.

Now: Plugins like Mutate can access and convert elements within arrays
to specific types, or, updating their values.
2014-11-13 08:34:41 -08:00
Pier-Hugues Pellerin
9af51505b6 Allow unary operators and comparable on timestamp object closes #2052
Fixes #2061
2014-11-12 20:30:26 +00:00
Richard Pijnenburg
f472d4af24 Cleanup plugins to move to plugin system
Plugins have moved to https://github.com/logstash-plugins/... into
individual repositories. One plugin per repo.

* Add plugin install task and add required plugins for testing
* Adding a plugin task to install plugins
* Added required plugins to a prep task for the test part.

Fixes #1984
2014-11-04 23:24:59 +00:00
Jordan Sissel
920a9e9362 Refactor build tooling to use Ruby
The new way to build is using 'rake' and not 'make'.

For some some attempt at compatibility, any 'make' invocation will
invoke rake. `make foo` will invoke `rake foo`.

This is for #1640

Major changes:
* rake is used instead of make. This allows us to more easily improve,
  debug, and test the build tooling.
* The build process can be bootstrapped from any Ruby that has
  Rake available. Bootstrapping rake is automatic will download JRuby and
  re-execute itself under JRuby.
* rpm and deb packages no longer list any java as dependencies. This
  is the result of user discomfort and discussions which concluded
  that there is no good way to "depend" on Java via rpm or deb.

Internal changes:
* Vendoring paths are project-based. Each vendor directory is now
  specific as vendor/<project>/... For example, JRuby is dumped into
  vendor/jruby/...

Other changes:

* We don't use jruby-complete anymore. We now use bin/jruby as the entry point.
  This improves the startup time of Logstash on my laptop by approximately
  1.5 seconds (~25% speedup of startup time). Testing `bin/logstash
  version` speed; 5 runs each:

  * Before patch: 7.27 7.55 7.26 7.42 7.47
  * After patch: 5.54 5.97 5.67 5.58 5.54

Smaller changes:
- removed 'env' subcommand
- Remove 'deps' subcommand. Replaced by 'rake vendor:all'
- Add gem_home method for this platform's GEM_HOME
- .travis.yml removed because we haven't used Travis in a long time.
- bin/logstash exits nonzero with a useful message if JRuby can't be found.

Notes:

Invoke bundler via system() call instead of Bundler::CLI.
After some discussion in #bundler on freenode (very helpful!) on how
to do what we need to do with bundler, I was encouraged to not use the
bundler api from ruby, so system() it is.

Patch slightly modified to fit the new model of packaging (ruby instead
of shell invocation), but original author is obazoud in #1008.

Richard Pijnenburg helped with some of the code and was lovely in
helping test it.

Fixes #1640
2014-10-22 17:04:55 +00:00
Jordan Sissel
a843d25f97 Fix metadata testing failures
This bug was introduced in the recent metadata patch. The problem was
caused by a testing-specific monkeypatch on LogStash::Event#[]=

I fixed this by moving the strict_set input validation from
LogStash::Util::Accessors to LogStash::Event as a class method.
Then monkeypatched the Event#[]=  to invoke validation before doing
the set operation. This now makes it call the original []= method
and should help keep future breakages from happening.

Fixes #1936
2014-10-22 16:50:58 +00:00
Suyog Rao
4f0ddf8851 Remove the rescue so we can see what errors we get
Closes #1931
2014-10-21 18:21:38 -07:00
Tal Levy
742ddadc3a Include stud/try module to elasticsearch_spec test
Previously, a few elasticsearch integration tests relied on this module,
but the module could not be found.

Fixes #1929
2014-10-21 20:19:56 +00:00
Colin Surprenant
f19e9fe2c4 add elasticsearch spec tag to exclude on external ES dependency
Fixes #1920
2014-10-20 18:01:11 +00:00
Pier-Hugues Pellerin
0f6d4a235f DNS Filter spec should always mock the call to the resolv library Fix: #1875
Fixes #1878
2014-10-20 17:51:14 +00:00
Jordan Sissel
12d8e82df6 Add metadata via @metadata field
This makes @metadata basically a way to store data along with an event
that is *NOT* included when serialized to an output.

Use cases:
- For elasticsearch output, set the index, type, document_id, routing
  key, etc with metadata and you won't be burdened by storing a filed
  named 'index' in your document!
- For elasticsearch input, we can set @metadata fields for the
  index/type/document_id instead of polluting the event data itself.
- No need for "short-lived fields" such as timestamps. For example, a
  common pattern is to use grok to capture a timestamp text  and give that
  to the date filter and finally use mutate to remove that captured text
  field.
- Provide a kind of scratch space for events that are not part of the
  event data.

Fixes #1834

Fixes #1836
2014-10-10 21:34:59 +00:00
Chen,Hao
4a3194bda5 ElasticSearch output plugin to support multiple hosts and enhance stability. (by Hao Chen)
Closes #1791
2014-10-09 17:24:14 -07:00
Jordan Sissel
dc079df736 codec/line: do charset conversion on flush
Add tests to verify line codec does charset conversion on flush.

Fixes #1520
2014-10-02 16:31:56 +00:00
Suyog Rao
284ec9f049 remove kafka source since they moved to separate plugin
Closes #1801
2014-09-30 14:37:33 -07:00
Richard Pijnenburg
cf22421700 [TESTING] Convert ruby filter spec after rebase
Fixes #1758
2014-09-30 16:06:48 +00:00
Richard Pijnenburg
79c4802e45 Minor fixes after review
Fixes #1758
2014-09-30 16:06:48 +00:00
Richard Pijnenburg
6daeb22685 [TESTING] Fix Kafka output test
When doing randomized testing, one of the tests failed because kafka was not initialized yet

Fixes #1758
2014-09-30 16:06:48 +00:00
Richard Pijnenburg
42fa9eab3b [TESTING] Fix tcp input spec test
Fixes #1758
2014-09-30 16:06:47 +00:00
Richard Pijnenburg
ef23308701 Fix performance tests
- date speed test only run when performance is enabled

Fixes #1758
2014-09-30 16:06:47 +00:00