anschel 0.7.17 → 0.7.18

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 564ffbff082f29ab42433c5a0b172e9f67d79fe5
4
- data.tar.gz: d47ee96175ed0548fe7547343a7d8e45ddac61c7
3
+ metadata.gz: 57d552039583a32d71b6a0f66bc2c5e7bede4f3b
4
+ data.tar.gz: 86baee5ddf97f19a76ee2abe6a59346c82ca1327
5
5
  SHA512:
6
- metadata.gz: 6217f2630e912cecd1f4a17cb0bc333cf01b266e2fa998194215f9bfaab4eadcac52deab206fd0125c7e0617d40c5b422201d04ba6a86d9af8bf88d8667e9dc1
7
- data.tar.gz: 2977ea58bf6565a5ea13450354fbe806e8114eeaa41db674f593629b16e0e309dc61d0ac3437aec8d1b7a1375f4f788ccc45a45277a89529edb3f5675f6397b9
6
+ metadata.gz: 1ce210593c0713838845c8e1c418f5b2f7b48a7611a878f2dc62e10a52ba379cf1738b548cd23a858e6bfc5e4b2a93295f6bfd3da9f730c63c7b13120a1d11ce
7
+ data.tar.gz: 9f793daee4ce713070d7946f072d0a1d560c6813ad60beaaedfe90bd50fe67f925a43283c53a91883404a1c0ef60da751304e0058098a40b1f805ad1a8cb1df3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.17
1
+ 0.7.18
@@ -8,7 +8,7 @@ module Anschel
8
8
  class Filter
9
9
  def parse conf, stats, log
10
10
  field = conf.delete :field
11
- pattern = Regexp.new conf.delete(:pattern)
11
+ pattern = conf.delete(:pattern) || conf.delete(:patterns)
12
12
  unless_field = conf.delete(:unless_field) || '@timestamp'
13
13
 
14
14
  error_tag = conf.has_key?(:error_tag) ? conf[:error_tag] : 'parse-error'
@@ -18,13 +18,15 @@ module Anschel
18
18
 
19
19
  field = field.to_sym
20
20
  unless_field = unless_field.to_sym
21
+ patterns = pattern.is_a?(Array) ? pattern : [ pattern ]
22
+ patterns = patterns.map { |p| Regexp.new p }
21
23
 
22
24
  stats.create 'filter-parse'
23
25
  stats.create 'filter-parse-skipped'
24
26
  stats.create 'filter-parse-error'
25
27
 
26
28
  log.info event: 'filter-compiled', kind: 'parse', \
27
- field: field, pattern: pattern
29
+ field: field, patterns: patterns
28
30
 
29
31
 
30
32
 
@@ -39,7 +41,11 @@ module Anschel
39
41
  return event
40
42
  end
41
43
 
42
- mdata = pattern.match event[field]
44
+ mdata = nil
45
+ patterns.each do |p|
46
+ mdata = p.match event[field]
47
+ break if mdata
48
+ end
43
49
 
44
50
  if mdata.nil?
45
51
  log.warn \
@@ -66,8 +66,6 @@ module Anschel
66
66
  return event
67
67
  end
68
68
 
69
- event_field = event[field].dup
70
-
71
69
  matched = false
72
70
  parsers.each do |joda|
73
71
  begin
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given a float as a string" tests="1" time="0.01" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert it to a float" time="0.005951291008386761" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given a string as an integer" tests="1" time="0.003" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert it to a string" time="0.005551919020945206" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given a string of digits" tests="1" time="0.007" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert them to pound signs" time="0.02635498100426048" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given a string with dashes" tests="1" time="0.008" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert the dashes to underscores" time="0.008427391003351659" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given a string with &quot;hello&quot;" tests="1" time="0.005" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert &quot;hello&quot; to &quot;goodbye&quot;" time="0.007907345017883927" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given an float as nil" tests="1" time="0.004" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert it to zero" time="0.005214214994339272" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given an integer as a string" tests="1" time="0.008" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert it to an integer" time="0.003261231991928071" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when given an integer as nil" tests="1" time="0.008" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert it to zero" time="0.006532276980578899" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when multiple fields match" tests="1" time="0.009" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must gsub each" time="0.007517606019973755" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when multiple fields match" tests="1" time="0.009" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must convert each" time="0.006137271993793547" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when multiple matches apply" tests="1" time="0.006" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must gsub each" time="0.004829648009035736" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when no field matches" tests="1" time="0.007" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must do nothing" time="0.004181656986474991" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when no fields match" tests="1" time="0.007" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must do nothing" time="0.005929930019192398" assertions="1">
4
+ </testcase>
5
+ </testsuite>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuite name="Anschel::Filter::when no matches are found" tests="1" time="0.008" failures="0" errors="0" skipped="0" assertions="1" timestamp="2016-02-18T11:56:32-08:00">
3
+ <testcase name="test_0001_must do nothing" time="0.008219643990742043" assertions="1">
4
+ </testcase>
5
+ </testsuite>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anschel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.17
4
+ version: 0.7.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Clemmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -184,6 +184,20 @@ files:
184
184
  - lib/anschel/output/elasticsearch.rb
185
185
  - lib/anschel/stats.rb
186
186
  - lib/anschel/store.rb
187
+ - test/reports/TEST-Anschel-Filter-when-given-a-float-as-a-string.xml
188
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-as-an-integer.xml
189
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-of-digits.xml
190
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-with-dashes.xml
191
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-with-hello-.xml
192
+ - test/reports/TEST-Anschel-Filter-when-given-an-float-as-nil.xml
193
+ - test/reports/TEST-Anschel-Filter-when-given-an-integer-as-a-string.xml
194
+ - test/reports/TEST-Anschel-Filter-when-given-an-integer-as-nil.xml
195
+ - test/reports/TEST-Anschel-Filter-when-multiple-fields-match.0.xml
196
+ - test/reports/TEST-Anschel-Filter-when-multiple-fields-match.xml
197
+ - test/reports/TEST-Anschel-Filter-when-multiple-matches-apply.xml
198
+ - test/reports/TEST-Anschel-Filter-when-no-field-matches.xml
199
+ - test/reports/TEST-Anschel-Filter-when-no-fields-match.xml
200
+ - test/reports/TEST-Anschel-Filter-when-no-matches-are-found.xml
187
201
  homepage: https://github.com/sczizzo/anschel
188
202
  licenses:
189
203
  - ISC
@@ -208,4 +222,18 @@ rubygems_version: 2.4.8
208
222
  signing_key:
209
223
  specification_version: 4
210
224
  summary: Logstash-like for moving events from Kafka into Elasticsearch
211
- test_files: []
225
+ test_files:
226
+ - test/reports/TEST-Anschel-Filter-when-given-a-float-as-a-string.xml
227
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-as-an-integer.xml
228
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-of-digits.xml
229
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-with-dashes.xml
230
+ - test/reports/TEST-Anschel-Filter-when-given-a-string-with-hello-.xml
231
+ - test/reports/TEST-Anschel-Filter-when-given-an-float-as-nil.xml
232
+ - test/reports/TEST-Anschel-Filter-when-given-an-integer-as-a-string.xml
233
+ - test/reports/TEST-Anschel-Filter-when-given-an-integer-as-nil.xml
234
+ - test/reports/TEST-Anschel-Filter-when-multiple-fields-match.0.xml
235
+ - test/reports/TEST-Anschel-Filter-when-multiple-fields-match.xml
236
+ - test/reports/TEST-Anschel-Filter-when-multiple-matches-apply.xml
237
+ - test/reports/TEST-Anschel-Filter-when-no-field-matches.xml
238
+ - test/reports/TEST-Anschel-Filter-when-no-fields-match.xml
239
+ - test/reports/TEST-Anschel-Filter-when-no-matches-are-found.xml