logstash-filter-translate 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- N2IzZDgwNzM5YWY5OTI5OGZjN2Y1NGM5ZmRlNGE0YmMzZjM2NDRhNA==
5
- data.tar.gz: !binary |-
6
- OTcyY2FkZjFiMTg4MDUwNDliOWU0NTUxZDE0YTVmYzcyMGEwMTdkMg==
2
+ SHA1:
3
+ metadata.gz: 46646b5c42903aa3b53c057a52f3cdb01574667d
4
+ data.tar.gz: 2d6b62873e4236da2b884f6df1f5fa2eef5de556
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZWU0ZGU5NmFlYTJlYmZhZWUwYjllM2M1YTVjYzA0OGY5NTE3NzE4ZGJiNTk5
10
- OWQyMzJhYjU3YTU1ZjEzZWVlNDlmOTQ3OGY5ODZjMThkYjJhZjM5NjM4NTQw
11
- Y2ViZjAzMjA3OTBhNjUyYmJmMTgzZmU0YjhjZWE4Yzc1ZGViODU=
12
- data.tar.gz: !binary |-
13
- Y2QzZTQ0ZGRjMTEwYTI4NzIzM2VjMTA1NTAyZjY5MTkwMGE5NGMwZGUxMzA1
14
- ZTlkNGEzODEzZWU5MDhkYTM3ZmIxNGFkOWE2MTJkYmE1MmYyMDRjMWMyMjA3
15
- OTUzOWRkNjQ5YTI3MzcyZjdkYjI3NmVmNTQ2Njk3NjJjMDBkZDQ=
6
+ metadata.gz: 895c3b7e311506ab84dc8c4cf5cbde9c8927cc83c40ad0e92cad2976e5e74ffae46a8ccce355272a8f2ab85648332a71052d0c033fe63c52e724621f61f0f95c
7
+ data.tar.gz: ba6356635422fb9e2e06747d0b66e3b3181c475bcb2414c63010143e93424a944e3a9429a45aaac5bbb1007acfdac99e05e04798777972e190835d2298145cfe
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  *.gem
2
2
  Gemfile.lock
3
3
  .bundle
4
+ vendor
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- gem 'rake'
3
- gem 'gem_publisher'
2
+ gemspec
3
+ gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2014 Elasticsearch <http://www.elasticsearch.org>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/Rakefile CHANGED
@@ -1,12 +1,7 @@
1
- require "gem_publisher"
2
-
3
- desc "Publish gem to RubyGems.org"
4
- task :publish_gem do |t|
5
- gem = GemPublisher.publish_if_updated("logstash-filter-translate.gemspec", :rubygems)
6
- puts "Published #{gem}" if gem
7
- end
1
+ @files=[]
8
2
 
9
3
  task :default do
10
4
  system("rake -T")
11
5
  end
12
6
 
7
+ require "logstash/devutils/rake"
@@ -6,18 +6,18 @@ require "logstash/namespace"
6
6
  # and/or a YAML file to determine replacement values.
7
7
  #
8
8
  # The dictionary entries can be specified in one of two ways: First,
9
- # the "dictionary" configuration item may contain a hash representing
9
+ # the `dictionary` configuration item may contain a hash representing
10
10
  # the mapping. Second, an external YAML file (readable by logstash) may be specified
11
- # in the "dictionary_path" configuration item. These two methods may not be used
11
+ # in the `dictionary_path` configuration item. These two methods may not be used
12
12
  # in conjunction; it will produce an error.
13
13
  #
14
- # Operationally, if the event field specified in the "field" configuration
14
+ # Operationally, if the event field specified in the `field` configuration
15
15
  # matches the EXACT contents of a dictionary entry key (or matches a regex if
16
- # "regex" configuration item has been enabled), the field's value will be substituted
16
+ # `regex` configuration item has been enabled), the field's value will be substituted
17
17
  # with the matched key's value from the dictionary.
18
18
  #
19
19
  # By default, the translate filter will replace the contents of the
20
- # maching event field (in-place). However, by using the "destination"
20
+ # maching event field (in-place). However, by using the `destination`
21
21
  # configuration item, you may also specify a target event field to
22
22
  # populate with the new translated value.
23
23
  #
@@ -29,7 +29,7 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
29
29
  milestone 1
30
30
 
31
31
  # The name of the logstash event field containing the value to be compared for a
32
- # match by the translate filter (e.g. "message", "host", "response_code").
32
+ # match by the translate filter (e.g. `message`, `host`, `response_code`).
33
33
  #
34
34
  # If this field is an array, only the first value will be used.
35
35
  config :field, :validate => :string, :required => true
@@ -40,9 +40,9 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
40
40
  config :override, :validate => :boolean, :default => false
41
41
 
42
42
  # The dictionary to use for translation, when specified in the logstash filter
43
- # configuration item (i.e. do not use the @dictionary_path YAML file)
43
+ # configuration item (i.e. do not use the `@dictionary_path` YAML file)
44
44
  # Example:
45
- #
45
+ # [source,ruby]
46
46
  # filter {
47
47
  # %PLUGIN% {
48
48
  # dictionary => [ "100", "Continue",
@@ -51,19 +51,19 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
51
51
  # "old version", "new version" ]
52
52
  # }
53
53
  # }
54
- # NOTE: it is an error to specify both dictionary and dictionary_path
54
+ # NOTE: it is an error to specify both `dictionary` and `dictionary_path`
55
55
  config :dictionary, :validate => :hash, :default => {}
56
56
 
57
57
  # The full path of the external YAML dictionary file. The format of the table
58
58
  # should be a standard YAML file. Make sure you specify any integer-based keys
59
59
  # in quotes. The YAML file should look something like this:
60
- #
60
+ # [source,ruby]
61
61
  # "100": Continue
62
62
  # "101": Switching Protocols
63
63
  # merci: gracias
64
64
  # old version: new version
65
65
  #
66
- # NOTE: it is an error to specify both dictionary and dictionary_path
66
+ # NOTE: it is an error to specify both `dictionary` and `dictionary_path`
67
67
  config :dictionary_path, :validate => :path
68
68
 
69
69
  # When using a dictionary file, this setting will indicate how frequently
@@ -71,7 +71,7 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
71
71
  config :refresh_interval, :validate => :number, :default => 300
72
72
 
73
73
  # The destination field you wish to populate with the translated code. The default
74
- # is a field named "translation". Set this to the same value as source if you want
74
+ # is a field named `translation`. Set this to the same value as source if you want
75
75
  # to do a substitution, in this case filter will allways succeed. This will clobber
76
76
  # the old value of the source field!
77
77
  config :destination, :validate => :string, :default => "translation"
@@ -82,14 +82,15 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
82
82
  # destination field's data, with the translated value substituted in-place.
83
83
  #
84
84
  # For example, consider this simple translation.yml, configured to check the `data` field:
85
+ # [source,ruby]
85
86
  # foo: bar
86
87
  #
87
- # If logstash receives an event with the `data` field set to "foo", and `exact => true`,
88
- # the destination field will be populated with the string "bar".
88
+ # If logstash receives an event with the `data` field set to `foo`, and `exact => true`,
89
+ # the destination field will be populated with the string `bar`.
89
90
 
90
91
  # If `exact => false`, and logstash receives the same event, the destination field
91
- # will be also set to "bar". However, if logstash receives an event with the `data` field
92
- # set to "foofing", the destination field will be set to "barfing".
92
+ # will be also set to `bar`. However, if logstash receives an event with the `data` field
93
+ # set to `foofing`, the destination field will be set to `barfing`.
93
94
  #
94
95
  # Set both `exact => true` AND `regex => `true` if you would like to match using dictionary
95
96
  # keys as regular expressions. A large dictionary could be expensive to match in this case.
@@ -100,15 +101,15 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
100
101
  config :regex, :validate => :boolean, :default => false
101
102
 
102
103
  # In case no translation occurs in the event (no matches), this will add a default
103
- # translation string, which will always populate "field", if the match failed.
104
+ # translation string, which will always populate `field`, if the match failed.
104
105
  #
105
106
  # For example, if we have configured `fallback => "no match"`, using this dictionary:
106
- #
107
+ # [source,ruby]
107
108
  # foo: bar
108
109
  #
109
- # Then, if logstash received an event with the field `foo` set to "bar", the destination
110
- # field would be set to "bar". However, if logstash received an event with `foo` set to "nope",
111
- # then the destination field would still be populated, but with the value of "no match".
110
+ # Then, if logstash received an event with the field `foo` set to `bar`, the destination
111
+ # field would be set to `bar`. However, if logstash received an event with `foo` set to `nope`,
112
+ # then the destination field would still be populated, but with the value of `no match`.
112
113
  config :fallback, :validate => :string
113
114
 
114
115
  public
@@ -1,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-translate'
4
- s.version = '0.1.4'
4
+ s.version = '0.1.6'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "A general search and replace tool which uses a configured hash and/or a YAML file to determine replacement values."
7
- s.description = "A general search and replace tool which uses a configured hash and/or a YAML file to determine replacement values."
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"
8
8
  s.authors = ["Elasticsearch"]
9
- s.email = 'richard.pijnenburg@elasticsearch.com'
10
- s.homepage = "http://logstash.net/"
9
+ s.email = 'info@elasticsearch.com'
10
+ s.homepage = "http://www.elasticsearch.org/guide/en/logstash/current/index.html"
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
@@ -17,10 +17,11 @@ Gem::Specification.new do |s|
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
18
 
19
19
  # Special flag to let us know this is actually a logstash plugin
20
- s.metadata = { "logstash_plugin" => "true", "group" => "filter" }
20
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
21
 
22
22
  # Gem dependencies
23
23
  s.add_runtime_dependency 'logstash', '>= 1.4.0', '< 2.0.0'
24
24
 
25
+ s.add_development_dependency 'logstash-devutils'
25
26
  end
26
27
 
@@ -1,8 +1,8 @@
1
- require "test_utils"
1
+ require "logstash/devutils/rspec/spec_helper"
2
2
  require "logstash/filters/translate"
3
3
 
4
4
  describe LogStash::Filters::Translate do
5
- extend LogStash::RSpec
5
+
6
6
 
7
7
  describe "exact translation" do
8
8
  config <<-CONFIG
metadata CHANGED
@@ -1,76 +1,87 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elasticsearch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.0
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.0
15
23
  requirement: !ruby/object:Gem::Requirement
16
24
  requirements:
17
- - - ! '>='
25
+ - - '>='
18
26
  - !ruby/object:Gem::Version
19
- version: !binary |-
20
- MS40LjA=
27
+ version: 1.4.0
21
28
  - - <
22
29
  - !ruby/object:Gem::Version
23
30
  version: 2.0.0
24
- type: :runtime
25
31
  prerelease: false
32
+ type: :runtime
33
+ - !ruby/object:Gem::Dependency
34
+ name: logstash-devutils
26
35
  version_requirements: !ruby/object:Gem::Requirement
27
36
  requirements:
28
- - - ! '>='
37
+ - - '>='
29
38
  - !ruby/object:Gem::Version
30
- version: !binary |-
31
- MS40LjA=
32
- - - <
39
+ version: '0'
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
33
43
  - !ruby/object:Gem::Version
34
- version: 2.0.0
35
- description: A general search and replace tool which uses a configured hash and/or
36
- a YAML file to determine replacement values.
37
- email: richard.pijnenburg@elasticsearch.com
44
+ version: '0'
45
+ prerelease: false
46
+ type: :development
47
+ 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
48
+ email: info@elasticsearch.com
38
49
  executables: []
39
50
  extensions: []
40
51
  extra_rdoc_files: []
41
52
  files:
42
53
  - .gitignore
43
54
  - Gemfile
55
+ - LICENSE
44
56
  - Rakefile
45
57
  - lib/logstash/filters/translate.rb
46
58
  - logstash-filter-translate.gemspec
47
- - spec/filters/translate.rb
48
- homepage: http://logstash.net/
59
+ - spec/filters/translate_spec.rb
60
+ homepage: http://www.elasticsearch.org/guide/en/logstash/current/index.html
49
61
  licenses:
50
62
  - Apache License (2.0)
51
63
  metadata:
52
64
  logstash_plugin: 'true'
53
- group: filter
54
- post_install_message:
65
+ logstash_group: filter
66
+ post_install_message:
55
67
  rdoc_options: []
56
68
  require_paths:
57
69
  - lib
58
70
  required_ruby_version: !ruby/object:Gem::Requirement
59
71
  requirements:
60
- - - ! '>='
72
+ - - '>='
61
73
  - !ruby/object:Gem::Version
62
74
  version: '0'
63
75
  required_rubygems_version: !ruby/object:Gem::Requirement
64
76
  requirements:
65
- - - ! '>='
77
+ - - '>='
66
78
  - !ruby/object:Gem::Version
67
79
  version: '0'
68
80
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.4.1
71
- signing_key:
81
+ rubyforge_project:
82
+ rubygems_version: 2.4.4
83
+ signing_key:
72
84
  specification_version: 4
73
- summary: A general search and replace tool which uses a configured hash and/or a YAML
74
- file to determine replacement values.
85
+ summary: A general search and replace tool which uses a configured hash and/or a YAML file to determine replacement values.
75
86
  test_files:
76
- - spec/filters/translate.rb
87
+ - spec/filters/translate_spec.rb