Commit graph

49 commits

Author SHA1 Message Date
Pere Urbon-Bayes
577d8377b8 This adds a feature to let users dump all their installed plugins,
including dependencies, and reuse them in an offline installation by
providing an package for it. It adds two important commands to the
plugin manager, the pack and upack, to handle package creation and
installation and adds the --local flag to install and update to pull
plugins from the installed local packages.

Former commits:

add a task to create a bundle, under vendor/cache of the installed gems + their dependencies, this can be used later on to be installed offline

add an option to pass the --local flag to the bin/plugin update task, so it fetch plugins from a local cache, by default under vendor/cache

rename package:build to package:build-cache as is more meaningfull

add a --local flag to bin/plugin install to users can install plugins from the local cache, under the default directory of vendor/cache

add a plugin manager command to build the local cache of installed plugins using bundler package alike command

It adds code for compressing and extracting in zip and tar formats to
the utils module of logstash. The zip module is only jruby dependant as
it uses functions provided by java.
There is also code add in the plugin manager package command to handle
compression of plugins dumping.

Cleanup the custom java code to compress and extract zip files as it has
been known that using rubyzip is good and it has a more ruby like
features so the code is more clean and portable.

set of smallish improvement requested during review

added several options to handle situation when the package of plugins we want to generate is already there

clean up old code

applyed feedback from review, mostly changed in documentating behaviour plus better wording for messages

relocate the Environment.windows? check to the bootstrap side as it's used also in the plugin manager

add an unpack bin/plugin command so users can install packages of plugins throw the plugin manager

document override behaviour in the compress helpers (for zip and tar) plus add a fix for the tar extract when reading entries

made the unpack filename parameter a required one

add a force option to the bin/plugin unpack command

add a notice to that if using a local cache the --local flag should be passed with

Code cleanup and refactor introduced during review

add two wording suggestions comming from review

ammend more wording

skip the major version validation as in situation where there is no internet connection like when using the local vendor/cache to do the update

move compress to the bootstrap environment as being used in the plugin manager means not being loaded with logstash-core

Bring pack cached gems in the vendor directory so they can be used for bundler when packaging dependencies

Revert "Bring pack cached gems in the vendor directory so they can be used for bundler when packaging dependencies"

This reverts commit a9d7f46649932b06efaafebdd0eed2b4c63c2235.

patch the Bundler::Source::Rubygems to fetch only gems from a remote  source

small changes in several parts of the plugin manager and the creation of a common pack command with shared code

change compress to read in chuncks

fix wrong var name in the bootstrap compress utils module

fix namespacing conflicts

add basic test for the compress utility module

ammend more namespace issues

add a comment to the rubygems mockey patch to rebuild the gem cache

apply cosmetic changes

make the compress module raise CompressError

remove vendor_path and pattern_path form environment as they where mix up during rebase

change the bin/pack force option to be force-delete-cache

rename force_delete_cache to overwrite

change force for overwrite in tha pack command

remove the override option for bin/plugin unpack

revert Gemfile and Genfile.lock wrong committed
2015-11-18 16:28:50 +01:00
Colin Surprenant
12a5982da2 logstash-core & logstash-core-event extraction to support logstash-core-event-java impl, relates to #4191
fixed timezone issue

extracted logstash-core and reorganized specs

extracted logstash-core-event

extract java Event into logstash-core-event-java in a proper gem

remove obsolete jruby_event bootstrapping

fix require path

add java code bootstrap

use logstash-core-event/logstash-core-event.rb

remove obsolete files

basic instructions

LogStash::Json need to be initialized from event

update jruby and gradle versions

update compile:logstash-core-event-java rake task

WIP tasks refactor

fix gem.files

skip test if class is not defined

fix gem related tasks for new structure

add gem spec dirs in core tests

bootstrap java implementation when requiring timestamp

new Cloner class and Event clone impl

fix array fields assignments, see #4140

don't rely on json implementation ordering

fix skipped last iterpolation char

remove implementation specific unnecessary check

also require ruby classes

define error class in ruby

raise exception on invalid format

remove implementation specific tests and extract and put logger related test in pending

missing bits for having all core timestamp specs pass

run all core specs

remove leftover

comment regex

missing encoding header

revert to logstash-core-event by default

finished proper gemification

useless require

dynamically pick specs depending on logstash-core-event-* implementation

logstash root package version

missing file for proper gemification

do not build java event by default

always check for root logstash lib dir

fix concurrent-ruby version confict

fix rebase conflict

re-enable specs

user vars instead of constants

move non core code in bootstrap

document version files

move version file

remove useless code

use version in logstash-core

fix gem files list

put back concurrent-ruby version constrain as in master

add dependency on logstash-core-event

remove dependency on logstash-core to avoid circular dependency

fix rebase conflict

remove circular dependency

fix specs

update README
2015-11-16 17:16:10 -05:00
Colin Surprenant
43a5011bf9 logstash-core-event-java initial impl, relates to #4191
wip initial Accessors, Event, EventImpl, Path, Timestamp and PathTest

wip

wip

FieldReference and Accessors implementation

rename targetCache to lut and set it protected

initial Accessors tests

todo comment

more tests

Timestamp implementation

Timestamp tests

fix method name

add Long constructor

event initialization, timestamp handling and json serialization

add <> type information

custom json serializer for Timestamp

remove toJson test

initial Event test

more tests

comments

debug traces

initial jruby Event wrapper and specs

added PathCache

implemented includes

added clone

wrap all Event methods

Rakefile to build and jar

missing getters and implement overwrite

support Date conversion

proper cast and coercion

replace Ruby Event with Java Event

test for field reference setter type coercion

disable specs

timestap setter should also set in map, accept more timestamp types

pre cache timestamp and expose isTimestamp

constructor from DateTime

expose proper Ruby Timestamp object

Ruby Timestamp basic specs

also load JRuby Timestamp

transpose Java<->Ruby Timestamp

fix timestamp specs

new jar

cleanup object construction
2015-11-16 17:13:04 -05:00
Colin Surprenant
af245b9ed2 add specs for Retryable module
Fixes #4093
2015-11-05 21:05:53 +00:00
Colin Surprenant
42830bd09b cleanups
Fixes #4037
2015-10-15 21:31:08 +00:00
Colin Surprenant
c09481897c added FileWatch::BufferedTokenizer spec
Fixes #4037
2015-10-15 21:31:08 +00:00
guyboertje
5b47009648 Add basic defaults module and spec. Use defaults in pipeline and agent
move/rename defaults under config, use Concurrent.processor_count
remove method `filter_workers_count`

add CpuCoreStrategy module functions/tests. Use fifty_percent as default.

use extend self for Module functions

added defaults printing facility

change comment

add tests to defaults printer subsystem

closes #3852
2015-09-24 14:59:05 +01:00
Andrew Cholakian
f2fcc41aee Non Oracle Javas are all detected as 'good'
Fixes #3824
2015-08-31 14:16:13 +00:00
Pere Urbon-Bayes
028d76497c add the missing magic header # encoding: utf-8 so all internal strings are UTF-8 in Ruby < 2.0
Fixes #3723
2015-08-17 13:30:07 +00:00
Andrew Cholakian
9e88c90b28 Handle non-hotspot javas in version check
Fixes #3685
2015-08-03 21:25:58 +00:00
Andrew Cholakian
f7b76fa2ae Fix namespacing for unicode trimmer
Fixes #3593
2015-07-10 21:34:52 +00:00
Pere Urbon-Bayes
bd7516108f workarround the version check for pre released plugins as looks like rubygems is not activating them by default
Add a pre release gem test by using a mock to reproduce the behaviour
reaised by Gem::Specification.find_by_name when dealing with pre release
gems.

Fixes #3476
2015-07-02 16:06:48 +00:00
Andrew Cholakian
13ed78790f Add unicode trimmer utility function
Fixes #3505
2015-06-26 20:13:59 +00:00
Pier-Hugues Pellerin
1380119ac8 Removing reference of fieldreference
Fixes #3467
2015-06-26 17:35:46 +00:00
Andrew Cholakian
193d6096e1 DRYed up java version tests
Fixes #3452
2015-06-19 19:07:23 +00:00
Andrew Cholakian
9c23cf7b09 Expand out some combined test cases
Fixes #3452
2015-06-19 19:07:23 +00:00
Andrew Cholakian
5fd8d54e97 Use subject instead of let
Fixes #3452
2015-06-19 19:07:22 +00:00
Andrew Cholakian
259f3daeb2 Return explicit false on bad java version
Fixes #3452
2015-06-19 19:07:22 +00:00
Andrew Cholakian
5729fb9a0a Check java versioning
Fixes #3452
2015-06-19 19:07:20 +00:00
Pere Urbon-Bayes
e2450f1f78 Make the necessary changes to use rspec3 as a default test runner for
logstash, including adapting the test suites that were still using 2.x
syntax.
2015-06-08 12:19:11 +02:00
Colin Surprenant
3d1847aecc fix accessors field references caching performance regression
correct use of @lut and cleanups

leftover

added docs and renamed a few identifiers for clarity

typos

remove strict_set stuff since its not used anymore

removed unused specs

PathCache thread safety
2015-06-05 15:18:19 -04:00
Colin Surprenant
48bcc5b74d cleanup dependencies and rely on logstash-core gem
remove unused load path

use either local core lib dir or logstash-core gem

include spec in logstash-core

do not include lib, spec and locales dirs in package root

environment bootstrapping in lib/bootstrap.rb

added comments

move pluginmanager out of logstash-core

kafla installation solved by pluginmanager refactor

refactor bootstrap code

refactor shell scripts to simplify and DRY, indirect rspec command to our ruby launcher

add bin/rspec

cut by half the bin/plugin and bin/rspec startup time

fix drip context

use printf instead of tr

updated Windows bin scripts

missing gemspec in gemspec

use gem instead of gemspec so our plugin manager can correctly install logstash-core

generate packages including locally built logstash-core gem

move jenkins developmnent dependencies into Gemfile, they do not belong in logstash-core

path leftover

clean help agent help usage message and remore rspec in available command

comments cosmetics

update Bundler dependency, all recent testing have been made with 1.9.4

updated .lock file with regard to updated Gemfile

cleanup gemspec, Gemfile and regen .lock file

added progress output

avoid dual require on version

closes #3096
2015-05-04 18:17:22 -04:00
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
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
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
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
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
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
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
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
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
Richard Pijnenburg
79c4802e45 Minor fixes after review
Fixes #1758
2014-09-30 16:06:48 +00:00
Richard Pijnenburg
51b3bf46c4 [RSPEC] Refactoring step 1
- Move helper functions in own modules and extend Rspec
- Refactor files into correct naming and paths
- Modify files to use new spec_helper and helpers
- Pin rspec to 2.14.x

Fixes #1758
2014-09-30 16:06:46 +00:00
Van Eenwyk, Jonathan
82650a21ba Fix problem accessing array-indexed fields.
This change fixes accessing fields of the form [list][0][key], where
[list] is an array, [0] is the numeric index into the array, and [key]
is the hash key into one of the items in the array.
2014-04-07 15:21:40 -06:00
Colin Surprenant
3ed6078a65 Accessor#strict_set for encoding validation in specs 2014-03-22 01:06:25 -04:00
Colin Surprenant
5d5d8e2235 proper utf8 support in plugins which assigned non utf8 event field values 2014-03-14 21:33:51 -04:00
Colin Surprenant
6796736def Fieldreference replacement 2014-03-14 14:55:25 -04:00
Colin Surprenant
d083dcb264 actually encode to UTF-8 when input charset is non UTF-8 + basic specs 2014-03-12 16:02:21 -07:00
Jordan Sissel
dd13128be5 - add require 2013-08-13 22:07:39 -07:00
Jordan Sissel
cd102cd39d - Rename HashEval -> FieldReference (LOGSTASH-1250) 2013-08-09 09:08:10 -07:00
Jordan Sissel
ad3839f4c1 Add another case for block testing 2013-08-08 23:23:54 -07:00
Jordan Sissel
ab5f56c855 Add a hash evaluation compiler
Syntax supported: somekey, [somekey], [some][nested][thing]
2013-08-06 17:45:22 -07:00