logstash-filter-translate 3.1.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ require "logstash/devutils/rspec/spec_helper"
2
+
3
+ require "logstash/filters/dictionary/yaml_visitor"
4
+
5
+ describe LogStash::Filters::Dictionary::YamlVisitor do
6
+ it 'works' do
7
+ yaml_string = "---\na: \n x: 3\nb: \n x: 4\n"
8
+ dictionary = {"c" => {"x" => 5}}
9
+ described_class.create.accept_with_dictionary(dictionary, Psych.parse_stream(yaml_string)).first
10
+ expect(dictionary.keys.sort).to eq(["a", "b", "c"])
11
+ values = dictionary.values
12
+ expect(values[0]).to eq({"x" => 5})
13
+ expect(values[1]).to eq({"x" => 3})
14
+ expect(values[2]).to eq({"x" => 4})
15
+ end
16
+ end
@@ -0,0 +1,4 @@
1
+ "^2[0-9][0-9]$","OK"
2
+ "^3[0-9][0-9]$","Redirect"
3
+ "^4[0-9][0-9]$","Client Error"
4
+ "^5[0-9][0-9]$","Server Error"
@@ -0,0 +1,4 @@
1
+ "200","OK"
2
+ "300","Redirect"
3
+ "400","Client Error"
4
+ "500","Server Error"
@@ -0,0 +1,21 @@
1
+ ---
2
+ !!map {
3
+ ? !!str "eight"
4
+ : !!str "val-8-1|val-8-2",
5
+ ? !!str "five"
6
+ : !!str "val-5-1|val-5-2",
7
+ ? !!str "four"
8
+ : !!str "val-4-1|val-4-2",
9
+ ? !!str "nine"
10
+ : !!str "val-9-1|val-9-2",
11
+ ? !!str "one"
12
+ : !!str "val-1-1|val-1-2",
13
+ ? !!str "seven"
14
+ : !!str "val-7-1|val-7-2",
15
+ ? !!str "six"
16
+ : !!str "val-6-1|val-6-2",
17
+ ? !!str "three"
18
+ : !!str "val-3-1|val-3-2",
19
+ ? !!str "two"
20
+ : !!str "val-2-1|val-2-2",
21
+ }
@@ -0,0 +1,21 @@
1
+ ---
2
+ !!omap {
3
+ ? !!str "eight"
4
+ : !!str "val-8-1|val-8-2",
5
+ ? !!str "five"
6
+ : !!str "val-5-1|val-5-2",
7
+ ? !!str "four"
8
+ : !!str "val-4-1|val-4-2",
9
+ ? !!str "nine"
10
+ : !!str "val-9-1|val-9-2",
11
+ ? !!str "one"
12
+ : !!str "val-1-1|val-1-2",
13
+ ? !!str "seven"
14
+ : !!str "val-7-1|val-7-2",
15
+ ? !!str "six"
16
+ : !!str "val-6-1|val-6-2",
17
+ ? !!str "three"
18
+ : !!str "val-3-1|val-3-2",
19
+ ? !!str "two"
20
+ : !!str "val-2-1|val-2-2",
21
+ }
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require "securerandom"
4
+
5
+ module LogStash module Filters module Dictionary
6
+ def self.create_huge_csv_dictionary(directory, name, size)
7
+ tmppath = directory.join("temp_big.csv")
8
+ tmppath.open("w") do |file|
9
+ file.puts("foo,#{SecureRandom.hex(4)}")
10
+ file.puts("bar,#{SecureRandom.hex(4)}")
11
+ size.times do |i|
12
+ file.puts("#{SecureRandom.hex(12)},#{1000000 + i}")
13
+ end
14
+ file.puts("baz,quux")
15
+ end
16
+ tmppath.rename(directory.join(name))
17
+ end
18
+
19
+ def self.create_huge_json_dictionary(directory, name, size)
20
+ tmppath = directory.join("temp_big.json")
21
+ tmppath.open("w") do |file|
22
+ file.puts("{")
23
+ file.puts(' "foo":"'.concat(SecureRandom.hex(4)).concat('",'))
24
+ file.puts(' "bar":"'.concat(SecureRandom.hex(4)).concat('",'))
25
+ size.times do |i|
26
+ file.puts(' "'.concat(SecureRandom.hex(12)).concat('":"').concat("#{1000000 + i}").concat('",'))
27
+ end
28
+ file.puts(' "baz":"quux"')
29
+ file.puts("}")
30
+ end
31
+ tmppath.rename(directory.join(name))
32
+ end
33
+ end end end
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+
3
+ module RSpec
4
+ module Wait
5
+ module Handler
6
+ def handle_matcher(target, *args, &block)
7
+ # there is a similar patch in the rspec-wait repo since Nov, 19 2017
8
+ # it does not look like the author is interested in the change.
9
+ # - do not use Ruby Timeout
10
+ count = RSpec.configuration.wait_timeout.fdiv(RSpec.configuration.wait_delay).ceil
11
+ failure = nil
12
+ count.times do
13
+ begin
14
+ actual = target.respond_to?(:call) ? target.call : target
15
+ super(actual, *args, &block)
16
+ failure = nil
17
+ rescue RSpec::Expectations::ExpectationNotMetError => failure
18
+ sleep RSpec.configuration.wait_delay
19
+ end
20
+ break if failure.nil?
21
+ end
22
+ raise failure unless failure.nil?
23
+ end
24
+ end
25
+
26
+ # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/handler.rb#L44-L63
27
+ class PositiveHandler < RSpec::Expectations::PositiveExpectationHandler
28
+ extend Handler
29
+ end
30
+
31
+ # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/handler.rb#L66-L93
32
+ class NegativeHandler < RSpec::Expectations::NegativeExpectationHandler
33
+ extend Handler
34
+ end
35
+ end
36
+ end
37
+
38
+ RSPEC_WAIT_HANDLER_PATCHED = true
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: 3.1.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-04 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -30,6 +30,62 @@ dependencies:
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.99'
33
+ - !ruby/object:Gem::Dependency
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '1.2'
39
+ name: logstash-mixin-ecs_compatibility_support
40
+ prerelease: false
41
+ type: :runtime
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.2'
47
+ - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
53
+ name: logstash-mixin-validator_support
54
+ prerelease: false
55
+ type: :runtime
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.0'
61
+ - !ruby/object:Gem::Dependency
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.0'
67
+ name: logstash-mixin-deprecation_logger_support
68
+ prerelease: false
69
+ type: :runtime
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.0'
75
+ - !ruby/object:Gem::Dependency
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ name: rufus-scheduler
82
+ prerelease: false
83
+ type: :runtime
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
33
89
  - !ruby/object:Gem::Dependency
34
90
  requirement: !ruby/object:Gem::Requirement
35
91
  requirements:
@@ -44,6 +100,48 @@ dependencies:
44
100
  - - ">="
45
101
  - !ruby/object:Gem::Version
46
102
  version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ name: rspec-sequencing
110
+ prerelease: false
111
+ type: :development
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ name: rspec-wait
124
+ prerelease: false
125
+ type: :development
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ requirement: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ name: benchmark-ips
138
+ prerelease: false
139
+ type: :development
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
47
145
  description: This gem is a Logstash plugin required to be installed on top of the
48
146
  Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
49
147
  gem is not a stand-alone program
@@ -59,14 +157,34 @@ files:
59
157
  - NOTICE.TXT
60
158
  - README.md
61
159
  - docs/index.asciidoc
160
+ - lib/logstash/filters/array_of_maps_value_update.rb
161
+ - lib/logstash/filters/array_of_values_update.rb
162
+ - lib/logstash/filters/dictionary/csv_file.rb
163
+ - lib/logstash/filters/dictionary/file.rb
164
+ - lib/logstash/filters/dictionary/json_file.rb
165
+ - lib/logstash/filters/dictionary/memory.rb
166
+ - lib/logstash/filters/dictionary/yaml_file.rb
167
+ - lib/logstash/filters/dictionary/yaml_visitor.rb
168
+ - lib/logstash/filters/fetch_strategy/file.rb
169
+ - lib/logstash/filters/fetch_strategy/memory.rb
170
+ - lib/logstash/filters/single_value_update.rb
62
171
  - lib/logstash/filters/translate.rb
63
172
  - logstash-filter-translate.gemspec
173
+ - spec/filters/benchmark_rspec.rb
174
+ - spec/filters/scheduling_spec.rb
64
175
  - spec/filters/translate_spec.rb
176
+ - spec/filters/yaml_visitor_spec.rb
65
177
  - spec/fixtures/dict-wrong.yml
66
178
  - spec/fixtures/dict.csv
67
179
  - spec/fixtures/dict.json
68
180
  - spec/fixtures/dict.other
69
181
  - spec/fixtures/dict.yml
182
+ - spec/fixtures/regex_dict.csv
183
+ - spec/fixtures/regex_union_dict.csv
184
+ - spec/fixtures/tag-map-dict.yml
185
+ - spec/fixtures/tag-omap-dict.yml
186
+ - spec/support/build_huge_dictionaries.rb
187
+ - spec/support/rspec_wait_handler_helper.rb
70
188
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
71
189
  licenses:
72
190
  - Apache License (2.0)
@@ -94,9 +212,18 @@ signing_key:
94
212
  specification_version: 4
95
213
  summary: Replaces field contents based on a hash or YAML file
96
214
  test_files:
215
+ - spec/filters/benchmark_rspec.rb
216
+ - spec/filters/scheduling_spec.rb
97
217
  - spec/filters/translate_spec.rb
218
+ - spec/filters/yaml_visitor_spec.rb
98
219
  - spec/fixtures/dict-wrong.yml
99
220
  - spec/fixtures/dict.csv
100
221
  - spec/fixtures/dict.json
101
222
  - spec/fixtures/dict.other
102
223
  - spec/fixtures/dict.yml
224
+ - spec/fixtures/regex_dict.csv
225
+ - spec/fixtures/regex_union_dict.csv
226
+ - spec/fixtures/tag-map-dict.yml
227
+ - spec/fixtures/tag-omap-dict.yml
228
+ - spec/support/build_huge_dictionaries.rb
229
+ - spec/support/rspec_wait_handler_helper.rb