logstash-filter-translate 0.1.8 → 0.1.9

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: be3ed72c06ab49bc1325f144706fe4e9c58c1823
4
- data.tar.gz: 1c76acd5401f2538ccfb4007b72f86a68c1af436
3
+ metadata.gz: ddbb66e251d0f50dbb1fa973dc30ff552ae7ff92
4
+ data.tar.gz: 33b4efb5fc770ec1694a98bbc35516dab8d495e1
5
5
  SHA512:
6
- metadata.gz: 1e8b97012f43311712082b49d2fc17654a4803a4f5bb843ef1148402e0ef2031c7ab180fd05669ab58def8ba375d9aa5f30076cc0728985ed0c95415044858fc
7
- data.tar.gz: b1fc109116b324fd449e9cb8d5297f3408244ca85d9c9a9747bce777ce0180b87c22b200e5ac0821626c8f7f089d5bec2970b79c1267133e472705a49b4fa035
6
+ metadata.gz: b145dcc680375c22121507aae3af58a8afd697d7367cd9b1e2c5b5842777ae85743b39cfa6408ca8fe9c1bb9dbc96dae3b6fbe60aeb8e332afc32178b1c6c364
7
+ data.tar.gz: e081385d7434ff5b791f125fa3dffbb0735f31f0e75f376634e6af3c1591d0d94c223f8db75a0ecefd6009435e0de57f6f81064aa43d419e9c938fc52dc655ff
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2015 Elasticsearch <http://www.elasticsearch.org>
1
+ Copyright (c) 20122015 Elasticsearch <http://www.elastic.co>
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -109,6 +109,7 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
109
109
  # Then, if logstash received an event with the field `foo` set to `bar`, the destination
110
110
  # field would be set to `bar`. However, if logstash received an event with `foo` set to `nope`,
111
111
  # then the destination field would still be populated, but with the value of `no match`.
112
+ # This configuration can be dynamic and include parts of the event using the `%{field}` syntax.
112
113
  config :fallback, :validate => :string
113
114
 
114
115
  public
@@ -184,7 +185,7 @@ class LogStash::Filters::Translate < LogStash::Filters::Base
184
185
  end
185
186
 
186
187
  if not matched and @fallback
187
- event[@destination] = @fallback
188
+ event[@destination] = event.sprintf(@fallback)
188
189
  matched = true
189
190
  end
190
191
  filter_matched(event) if matched or @field == @destination
@@ -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.8'
4
+ s.version = '0.1.9'
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
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
- s.authors = ["Elasticsearch"]
9
- s.email = 'info@elasticsearch.com'
10
- s.homepage = "http://www.elasticsearch.org/guide/en/logstash/current/index.html"
8
+ s.authors = ["Elastic"]
9
+ s.email = 'info@elastic.co'
10
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
@@ -67,4 +67,36 @@ describe LogStash::Filters::Translate do
67
67
  end
68
68
  end
69
69
 
70
+ describe "fallback value - static configuration" do
71
+ config <<-CONFIG
72
+ filter {
73
+ translate {
74
+ field => "status"
75
+ destination => "translation"
76
+ fallback => "no match"
77
+ }
78
+ }
79
+ CONFIG
80
+
81
+ sample("status" => "200") do
82
+ insist { subject["translation"] } == "no match"
83
+ end
84
+ end
85
+
86
+ describe "fallback value - allow sprintf" do
87
+ config <<-CONFIG
88
+ filter {
89
+ translate {
90
+ field => "status"
91
+ destination => "translation"
92
+ fallback => "%{missing_translation}"
93
+ }
94
+ }
95
+ CONFIG
96
+
97
+ sample("status" => "200", "missing_translation" => "no match") do
98
+ insist { subject["translation"] } == "no match"
99
+ end
100
+ end
101
+
70
102
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
- - Elasticsearch
7
+ - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -45,7 +45,7 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
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
48
+ email: info@elastic.co
49
49
  executables: []
50
50
  extensions: []
51
51
  extra_rdoc_files: []
@@ -59,7 +59,7 @@ files:
59
59
  - lib/logstash/filters/translate.rb
60
60
  - logstash-filter-translate.gemspec
61
61
  - spec/filters/translate_spec.rb
62
- homepage: http://www.elasticsearch.org/guide/en/logstash/current/index.html
62
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
63
63
  licenses:
64
64
  - Apache License (2.0)
65
65
  metadata:
@@ -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.4.5
84
+ rubygems_version: 2.1.9
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: A general search and replace tool which uses a configured hash and/or a YAML file to determine replacement values.