logstash-filter-dissect 1.1.4 → 1.2.0

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
  SHA256:
3
- metadata.gz: 21b60b83ce9a628a4c1879f0cffa16b3266595a5858fa5874998d3ca971718a6
4
- data.tar.gz: e6b49de027860dcd0f6316ff93632aa8dd33f2bc9323258babfdbe867ea23bb3
3
+ metadata.gz: 0426a95966922ea538ca2a8d48bcdb6f60193ad216a15ebddb6a816919de6d8b
4
+ data.tar.gz: 45e44ad23f1d46f9cba7a088e5842df61ed6054e6971781ebc5f2f303241893b
5
5
  SHA512:
6
- metadata.gz: ee8590d5715087e826fe63853919972602161ddeddb6055a3585aef0dc6c2a9ce5ca6c1bcdc575703fb145abf41381ec1e460b5fa2c224fea16b0325555c7c47
7
- data.tar.gz: 562fc016a5fe3e6312ecc1949a53764ebff4ae0a67cdfee903ca4c0f021ecdecd90fcedb690aba3acb35edb00ebf81960236315d383f33c12ef70a5b146deaaf
6
+ metadata.gz: 95749fcd548bf4412dc20f08d0a7aea50e5ca6e4f75154ed570014a927d6e6e95eb85c8b60e2293440e3049fd566ed9b0552cb121f06bdd4a384a10617b31ce7
7
+ data.tar.gz: 1763b8ee0c59bb7b2a25003146f698f2f15cc4cc9086026eded0ae9dbe1b6e22ff6c866fe7076c781cc699979b86150382f277ae5f442927267f1d1e8e08452e
@@ -1,3 +1,10 @@
1
+ ## 1.2.0
2
+ - Fix Trailing Delimiters requires a false field. A skip field is
3
+ automatically added when a final delimiter is detected in the dissect pattern.
4
+ This requires that strict delimiter finding is enforced - meaning a "no match"
5
+ results if every delimiter is not found in exactly the declared order
6
+ [Issue #22](https://github.com/logstash-plugins/logstash-filter-dissect/issues/22)
7
+
1
8
  ## 1.1.4
2
9
  - Replace v1.1.3 as it packaged the v1.1.1 jar and therefore does not have the fixes below
3
10
  - Yank v1.1.3 from rubygems.org
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.4
1
+ 1.2.0
@@ -34,7 +34,7 @@ The dissection is described using a set of `%{}` sections:
34
34
  %{a} - %{b} - %{c}
35
35
  ....
36
36
 
37
- A *field* is the text from `%` to `}` inclusive.
37
+ A *field* is the text from `%{` to `}` inclusive.
38
38
 
39
39
  A *delimiter* is the text between a `}` and next `%{` characters.
40
40
 
@@ -240,8 +240,8 @@ For example
240
240
  filter {
241
241
  dissect {
242
242
  convert_datatype => {
243
- cpu => "float"
244
- code => "int"
243
+ "cpu" => "float"
244
+ "code" => "int"
245
245
  }
246
246
  }
247
247
  }
@@ -1,4 +1,4 @@
1
1
  # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.
2
2
 
3
3
  require 'jar_dependencies'
4
- require_jar('org.logstash.dissect', 'jruby-dissect-library', '1.1.4')
4
+ require_jar('org.logstash.dissect', 'jruby-dissect-library', '1.2.0')
@@ -1,8 +1,6 @@
1
- DISSECT_VERSION = File.read(File.expand_path(File.join(File.dirname(__FILE__), "VERSION"))).strip unless defined?(DISSECT_VERSION)
2
-
3
1
  Gem::Specification.new do |s|
4
2
  s.name = 'logstash-filter-dissect'
5
- s.version = DISSECT_VERSION
3
+ s.version = '1.2.0' # version will be checked against VERSION file by `rake vendor`
6
4
  s.licenses = ['Apache License (2.0)']
7
5
  s.summary = "Extracts unstructured event data into fields using delimiters"
8
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -328,4 +328,25 @@ describe LogStash::Filters::Dissect do
328
328
  end
329
329
  end
330
330
  end
331
+
332
+ describe "Compatibility suite" do
333
+ tests = LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "/../fixtures/dissect_tests.json")))
334
+ tests.each do |test|
335
+ describe test["name"] do
336
+ let(:options) { { "mapping" => { "message" => test["tok"] } } }
337
+ subject { described_class.new(options) }
338
+ let(:event) { LogStash::Event.new({ "message" => test["msg"] }) }
339
+ before(:each) do
340
+ subject.register
341
+ subject.filter(event)
342
+ end
343
+
344
+ it "should dissect properly" do
345
+ test["expected"].each do |k, v|
346
+ expect(event.get(k)).to eq(v)
347
+ end
348
+ end
349
+ end
350
+ end
351
+ end
331
352
  end
@@ -0,0 +1,157 @@
1
+ [
2
+ {
3
+ "name": "Complex stack trace",
4
+ "tok": "%{day}-%{month}-%{year} %{hour} %{severity} [%{thread_id}] %{origin} %{message}",
5
+ "msg": "18-Apr-2018 06:53:20.411 INFO [http-nio-8080-exec-1] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header\n Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.\n java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens\n at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:426)\n at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687)\n at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)\n at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)\n at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)\n at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n at java.lang.Thread.run(Thread.java:748)",
6
+ "expected": {
7
+ "day": "18",
8
+ "hour": "06:53:20.411",
9
+ "message": "Error parsing HTTP request header\n Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.\n java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens\n at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:426)\n at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:687)\n at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)\n at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)\n at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)\n at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n at java.lang.Thread.run(Thread.java:748)",
10
+ "month": "Apr",
11
+ "origin": "org.apache.coyote.http11.Http11Processor.service",
12
+ "severity": "INFO",
13
+ "thread_id": "http-nio-8080-exec-1",
14
+ "year": "2018"
15
+ },
16
+ "skip": false
17
+ },
18
+ {
19
+ "name": "simple dissect",
20
+ "tok": "%{key}",
21
+ "msg": "foobar",
22
+ "expected": {
23
+ "key": "foobar"
24
+ },
25
+ "skip": false
26
+ },
27
+ {
28
+ "name": "dissect two replacement",
29
+ "tok": "%{key1} %{key2}",
30
+ "msg": "foo bar",
31
+ "expected": {
32
+ "key1": "foo",
33
+ "key2": "bar"
34
+ },
35
+ "skip": false
36
+ },
37
+ {
38
+ "name": "one level dissect not end of string",
39
+ "tok": "/var/%{key}/log",
40
+ "msg": "/var/foobar/log",
41
+ "expected": {
42
+ "key": "foobar"
43
+ },
44
+ "skip": false
45
+ },
46
+ {
47
+ "name": "one level dissect",
48
+ "tok": "/var/%{key}",
49
+ "msg": "/var/foobar/log",
50
+ "expected": {
51
+ "key": "foobar/log"
52
+ },
53
+ "skip": false
54
+ },
55
+ {
56
+ "name": "multiple keys dissect end of string",
57
+ "tok": "/var/%{key}/log/%{key1}",
58
+ "msg": "/var/foobar/log/apache",
59
+ "expected": {
60
+ "key": "foobar",
61
+ "key1": "apache"
62
+ },
63
+ "skip": false
64
+ },
65
+ {
66
+ "name": "multiple keys not end of string",
67
+ "tok": "/var/%{key}/log/%{key1}.log",
68
+ "msg": "/var/foobar/log/apache.log",
69
+ "expected": {
70
+ "key": "foobar",
71
+ "key1": "apache"
72
+ },
73
+ "skip": false
74
+ },
75
+ {
76
+ "name": "simple ordered",
77
+ "tok": "%{+key/3} %{+key/1} %{+key/2}",
78
+ "msg": "1 2 3",
79
+ "expected": {
80
+ "key": "2 3 1"
81
+ },
82
+ "skip": false
83
+ },
84
+ {
85
+ "name": "simple append",
86
+ "tok": "%{key}-%{+key}-%{+key}",
87
+ "msg": "1-2-3",
88
+ "expected": {
89
+ "key": "1-2-3"
90
+ },
91
+ "skip": false
92
+ },
93
+ {
94
+ "name": "indirect field",
95
+ "tok": "%{key} %{\u0026key}",
96
+ "msg": "hello world",
97
+ "expected": {
98
+ "hello": "world",
99
+ "key": "hello"
100
+ },
101
+ "skip": false
102
+ },
103
+ {
104
+ "name": "skip field",
105
+ "tok": "%{} %{key}",
106
+ "msg": "hello world",
107
+ "expected": {
108
+ "key": "world"
109
+ },
110
+ "skip": false
111
+ },
112
+ {
113
+ "name": "named skiped field with indirect",
114
+ "tok": "%{?key} %{\u0026key}",
115
+ "msg": "hello world",
116
+ "expected": {
117
+ "hello": "world"
118
+ },
119
+ "skip": false
120
+ },
121
+ {
122
+ "name": "missing fields",
123
+ "tok": "%{name},%{addr1},%{addr2},%{addr3},%{city},%{zip}",
124
+ "msg": "Jane Doe,4321 Fifth Avenue,,,New York,87432",
125
+ "expected": {
126
+ "addr1": "4321 Fifth Avenue",
127
+ "addr2": "",
128
+ "addr3": "",
129
+ "city": "New York",
130
+ "name": "Jane Doe",
131
+ "zip": "87432"
132
+ },
133
+ "skip": false
134
+ },
135
+ {
136
+ "name": "ignore right padding",
137
+ "tok": "%{id} %{function-\u003e} %{server}",
138
+ "msg": "00000043 ViewReceive machine-321",
139
+ "expected": {
140
+ "function": "ViewReceive",
141
+ "id": "00000043",
142
+ "server": "machine-321"
143
+ },
144
+ "skip": false
145
+ },
146
+ {
147
+ "name": "ignore left padding",
148
+ "tok": "%{id-\u003e} %{function} %{server}",
149
+ "msg": "00000043 ViewReceive machine-321",
150
+ "expected": {
151
+ "function": "ViewReceive",
152
+ "id": "00000043",
153
+ "server": "machine-321"
154
+ },
155
+ "skip": false
156
+ }
157
+ ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-dissect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.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-02-15 00:00:00.000000000 Z
11
+ date: 2018-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -94,8 +94,9 @@ files:
94
94
  - lib/logstash/filters/dissect.rb
95
95
  - logstash-filter-dissect.gemspec
96
96
  - spec/filters/dissect_spec.rb
97
+ - spec/fixtures/dissect_tests.json
97
98
  - spec/spec_helper.rb
98
- - vendor/jars/org/logstash/dissect/jruby-dissect-library/1.1.4/jruby-dissect-library-1.1.4.jar
99
+ - vendor/jars/org/logstash/dissect/jruby-dissect-library/1.2.0/jruby-dissect-library-1.2.0.jar
99
100
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html
100
101
  licenses:
101
102
  - Apache License (2.0)
@@ -125,4 +126,5 @@ specification_version: 4
125
126
  summary: Extracts unstructured event data into fields using delimiters
126
127
  test_files:
127
128
  - spec/filters/dissect_spec.rb
129
+ - spec/fixtures/dissect_tests.json
128
130
  - spec/spec_helper.rb