logstash-filter-environment 0.1.5 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a53e0f386b66828be7c72efffdbfc533ad52cdf3
4
- data.tar.gz: c68c657c37c5e79d83f90d95efe5fc9ab2a9cc5d
3
+ metadata.gz: e18db4701bc094d9aebd4fd92dbf1cac0ddbfde6
4
+ data.tar.gz: 36fd9fd8b5b6250fc19de93b4a15524362b2fdb9
5
5
  SHA512:
6
- metadata.gz: 23face99e4f55994db8da845bf42faa55cf3ed08acf688db294cf704db46ffe9bbb9cc677db86d7c15ebcb805e419844fc4b37dcca3fc8b67e00772ad26aa0bd
7
- data.tar.gz: 8dc9b27ea55b0e4eb91443f1b22778deec2fecf1825650579c210ea8c8290972ba5812ed447e907e2f13bb2cc3c32342bebd888db059135780301381584957c8
6
+ metadata.gz: da82518c7b001758e8651eec04434eb4a8bc0f61f396239a96cd8bb8dba2b12675296e2cf5d5b9d29b121c801058828f87f5c4dea8b5cf1fb6425bd348463137
7
+ data.tar.gz: e48ffc5db95774c7d8852865e19e62c509b4ac2534f9345e2fdef46539629ea7a574f4713c4fe7bcc9faf05defc20bf582034c942c92e9d5e528d05afce9c53c
@@ -0,0 +1,8 @@
1
+ ## 2.0.0
2
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
3
+ instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
4
+ - Dependency on logstash-core update to 2.0
5
+
6
+ 1.0.0
7
+ - Use @metadata instead of root-level fields
8
+ - This is a breaking change. Users will need to switch to use @metadata subfields in their configurations.
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
data/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # Logstash Plugin
2
2
 
3
- This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
3
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
4
 
5
5
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
6
6
 
7
7
  ## Documentation
8
8
 
9
- Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
9
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
10
10
 
11
11
  - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
- - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
13
 
14
14
  ## Need Help?
15
15
 
16
- Need help? Try #logstash on freenode IRC or the logstash-users@googlegroups.com mailing list.
16
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
17
17
 
18
18
  ## Developing
19
19
 
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
83
83
 
84
84
  It is more important to the community that you are able to contribute.
85
85
 
86
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -3,13 +3,43 @@ require "logstash/filters/base"
3
3
  require "logstash/namespace"
4
4
 
5
5
 
6
- # Set fields from environment variables
6
+ # This filter stores environment variables as subfields in the `@metadata` field.
7
+ # You can then use these values in other parts of the pipeline.
8
+ #
9
+ # Adding environment variables is as easy as:
10
+ # filter {
11
+ # environment {
12
+ # add_metadata_from_env { "field_name" => "ENV_VAR_NAME" }
13
+ # }
14
+ # }
15
+ #
16
+ # Accessing stored environment variables is now done through the `@metadata` field:
17
+ #
18
+ # ["@metadata"]["field_name"]
19
+ #
20
+ # This would reference field `field_name`, which in the above example references
21
+ # the `ENV_VAR_NAME` environment variable.
22
+ #
23
+ # IMPORTANT: Previous versions of this plugin put the environment variables as
24
+ # fields at the root level of the event. Current versions make use of the
25
+ # `@metadata` field, as outlined. You have to change `add_field_from_env` in
26
+ # the older versions to `add_metadata_from_env` in the newer version.
7
27
  class LogStash::Filters::Environment < LogStash::Filters::Base
8
28
  config_name "environment"
9
29
 
10
- # Specify a hash of fields to the environment variable
11
- # A hash of matches of `field => environment` variable
12
- config :add_field_from_env, :validate => :hash, :default => {}
30
+ # Specify a hash of field names and the environment variable name with the
31
+ # value you want imported into Logstash. For example:
32
+ #
33
+ # add_metadata_from_env { "field_name" => "ENV_VAR_NAME" }
34
+ #
35
+ # or
36
+ #
37
+ # add_metadata_from_env {
38
+ # "field1" => "ENV1"
39
+ # "field2" => "ENV2"
40
+ # # "field_n" => "ENV_n"
41
+ # }
42
+ config :add_metadata_from_env, :validate => :hash, :default => {}
13
43
 
14
44
  public
15
45
  def register
@@ -18,9 +48,9 @@ class LogStash::Filters::Environment < LogStash::Filters::Base
18
48
 
19
49
  public
20
50
  def filter(event)
21
- return unless filter?(event)
22
- @add_field_from_env.each do |field, env|
23
- event[field] = ENV[env]
51
+
52
+ @add_metadata_from_env.each do |field, env|
53
+ event["@metadata"][field] = ENV[env]
24
54
  end
25
55
  filter_matched(event)
26
56
  end # def filter
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-environment'
4
- s.version = '0.1.5'
4
+ s.version = '2.0.1'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Set fields from environment variables"
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -20,8 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency "logstash-core", ">= 2.0.0.snapshot", "< 3.0.0"
24
24
 
25
25
  s.add_development_dependency 'logstash-devutils'
26
26
  end
27
-
@@ -2,7 +2,7 @@ require "logstash/devutils/rspec/spec_helper"
2
2
  require "logstash/filters/environment"
3
3
 
4
4
  describe LogStash::Filters::Environment do
5
-
5
+
6
6
 
7
7
  describe "add a field from the environment" do
8
8
  # The logstash config goes here.
@@ -10,7 +10,7 @@ describe LogStash::Filters::Environment do
10
10
  config <<-CONFIG
11
11
  filter {
12
12
  environment {
13
- add_field_from_env => [ "newfield", "MY_ENV_VAR" ]
13
+ add_metadata_from_env => [ "newfield", "MY_ENV_VAR" ]
14
14
  }
15
15
  }
16
16
  CONFIG
@@ -18,7 +18,7 @@ describe LogStash::Filters::Environment do
18
18
  ENV["MY_ENV_VAR"] = "hello world"
19
19
 
20
20
  sample "example" do
21
- insist { subject["newfield"] } == "hello world"
21
+ insist { subject["@metadata"]["newfield"] } == "hello world"
22
22
  end
23
23
  end
24
24
 
@@ -29,7 +29,7 @@ describe LogStash::Filters::Environment do
29
29
  filter {
30
30
  environment {
31
31
  type => "foo"
32
- add_field_from_env => [ "newfield", "MY_ENV_VAR" ]
32
+ add_metadata_from_env => [ "newfield", "MY_ENV_VAR" ]
33
33
  }
34
34
  }
35
35
  CONFIG
@@ -37,7 +37,7 @@ describe LogStash::Filters::Environment do
37
37
  ENV["MY_ENV_VAR"] = "hello world"
38
38
 
39
39
  sample("type" => "bar", "message" => "fizz") do
40
- insist { subject["newfield"] }.nil?
40
+ insist { subject["@metadata"]["newfield"] }.nil?
41
41
  end
42
42
  end
43
43
  end
metadata CHANGED
@@ -1,24 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-environment
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - '>='
17
17
  - !ruby/object:Gem::Version
18
- version: 1.4.0
18
+ version: 2.0.0.snapshot
19
19
  - - <
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.0
21
+ version: 3.0.0
22
22
  name: logstash-core
23
23
  prerelease: false
24
24
  type: :runtime
@@ -26,10 +26,10 @@ dependencies:
26
26
  requirements:
27
27
  - - '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.4.0
29
+ version: 2.0.0.snapshot
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
- version: 2.0.0
32
+ version: 3.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
@@ -50,12 +50,12 @@ executables: []
50
50
  extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
- - .gitignore
53
+ - CHANGELOG.md
54
54
  - CONTRIBUTORS
55
55
  - Gemfile
56
56
  - LICENSE
57
+ - NOTICE.TXT
57
58
  - README.md
58
- - Rakefile
59
59
  - lib/logstash/filters/environment.rb
60
60
  - logstash-filter-environment.gemspec
61
61
  - spec/filters/environment_spec.rb
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.1.9
84
+ rubygems_version: 2.4.8
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: Set fields from environment variables
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"