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 +4 -4
- data/LICENSE +1 -1
- data/lib/logstash/filters/translate.rb +2 -1
- data/logstash-filter-translate.gemspec +4 -4
- data/spec/filters/translate_spec.rb +32 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddbb66e251d0f50dbb1fa973dc30ff552ae7ff92
|
4
|
+
data.tar.gz: 33b4efb5fc770ec1694a98bbc35516dab8d495e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b145dcc680375c22121507aae3af58a8afd697d7367cd9b1e2c5b5842777ae85743b39cfa6408ca8fe9c1bb9dbc96dae3b6fbe60aeb8e332afc32178b1c6c364
|
7
|
+
data.tar.gz: e081385d7434ff5b791f125fa3dffbb0735f31f0e75f376634e6af3c1591d0d94c223f8db75a0ecefd6009435e0de57f6f81064aa43d419e9c938fc52dc655ff
|
data/LICENSE
CHANGED
@@ -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.
|
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 = ["
|
9
|
-
s.email = 'info@
|
10
|
-
s.homepage = "http://www.
|
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.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
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@
|
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.
|
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.
|
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.
|