logstash-codec-multiline 2.0.11 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +12 -3
- data/logstash-codec-multiline.gemspec +3 -3
- data/spec/codecs/identity_map_codec_spec.rb +7 -7
- data/spec/codecs/multiline_spec.rb +20 -20
- data/spec/supports/helpers.rb +3 -3
- metadata +22 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38784ad7511d623d2bd6987582d81e62ecd9ab6f
|
4
|
+
data.tar.gz: d4333af39a5b897b3cc8cad99cf3d8d1c0b98cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 285ec4be2b5d46f4a572f35a9fe827945d5e6f7377f838ad7294d92b60bb7f9227f363c435e1ca92c17e250359312e61ddcfbf5c38597dc2d1eb2cb870613bc6
|
7
|
+
data.tar.gz: ff644bc901b1753fe612763b711d1c810d781ef1b4f48ebea91d83f9f3d123f38d6da22f68d0fed124ca578bc85e2a70a7b4000a9db91f6987a7c0e7b6bc65b9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
## 3.0.0
|
2
|
+
- Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
|
1
3
|
# 2.0.11
|
2
4
|
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
|
3
5
|
# 2.0.10
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
[![Build
|
4
|
-
Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Codecs/job/logstash-plugin-codec-multiline-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Codecs/job/logstash-plugin-codec-multiline-unit/)
|
3
|
+
[![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-codec-multiline.svg)](https://travis-ci.org/logstash-plugins/logstash-codec-multiline)
|
5
4
|
|
6
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
7
6
|
|
@@ -56,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
56
55
|
```
|
57
56
|
- Install plugin
|
58
57
|
```sh
|
58
|
+
# Logstash 2.3 and higher
|
59
|
+
bin/logstash-plugin install --no-verify
|
60
|
+
|
61
|
+
# Prior to Logstash 2.3
|
59
62
|
bin/plugin install --no-verify
|
63
|
+
|
60
64
|
```
|
61
65
|
- Run Logstash with your plugin
|
62
66
|
```sh
|
@@ -74,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
|
|
74
78
|
```
|
75
79
|
- Install the plugin from the Logstash home
|
76
80
|
```sh
|
77
|
-
|
81
|
+
# Logstash 2.3 and higher
|
82
|
+
bin/logstash-plugin install --no-verify
|
83
|
+
|
84
|
+
# Prior to Logstash 2.3
|
85
|
+
bin/plugin install --no-verify
|
86
|
+
|
78
87
|
```
|
79
88
|
- Start Logstash and proceed to test the plugin
|
80
89
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-codec-multiline'
|
4
|
-
s.version = '
|
4
|
+
s.version = '3.0.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "The multiline codec will collapse multiline messages and merge them into a single event."
|
7
|
-
s.description = "This gem is a
|
7
|
+
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"
|
8
8
|
s.authors = ["Elastic"]
|
9
9
|
s.email = 'info@elastic.co'
|
10
10
|
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "codec" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "~>
|
23
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'logstash-patterns-core'
|
26
26
|
s.add_runtime_dependency 'jls-grok', '~> 0.11.1'
|
@@ -237,14 +237,14 @@ describe LogStash::Codecs::IdentityMapCodec do
|
|
237
237
|
sleep 0.6 # wait for auto_flush - in multiples of 0.5 plus 0.1
|
238
238
|
expect(queue.size).to eq(3)
|
239
239
|
e1, e2, e3 = queue
|
240
|
-
expect(e1
|
241
|
-
expect(e1
|
240
|
+
expect(e1.get("path")).to eq("stream1")
|
241
|
+
expect(e1.get("message")).to eq("foo")
|
242
242
|
|
243
|
-
expect(e2
|
244
|
-
expect(e2
|
243
|
+
expect(e2.get("path")).to eq("stream2")
|
244
|
+
expect(e2.get("message")).to eq("bar")
|
245
245
|
|
246
|
-
expect(e3
|
247
|
-
expect(e3
|
246
|
+
expect(e3.get("path")).to eq("stream3")
|
247
|
+
expect(e3.get("message")).to eq("baz")
|
248
248
|
expect(imc.identity_count).to eq(3)
|
249
249
|
end
|
250
250
|
end
|
@@ -255,7 +255,7 @@ describe LogStash::Codecs::IdentityMapCodec do
|
|
255
255
|
it "flushes and removes the identity" do
|
256
256
|
expect(imc.identity_count).to eq(1)
|
257
257
|
imc.evict(identity)
|
258
|
-
expect(queue[0]
|
258
|
+
expect(queue[0].get("message")).to eq("foo")
|
259
259
|
expect(imc.identity_count).to eq(0)
|
260
260
|
end
|
261
261
|
end
|
@@ -29,10 +29,10 @@ describe LogStash::Codecs::Multiline do
|
|
29
29
|
codec.flush { |e| events << e }
|
30
30
|
|
31
31
|
expect(events.size).to eq(2)
|
32
|
-
expect(events[0]
|
33
|
-
expect(events[0]
|
34
|
-
expect(events[1]
|
35
|
-
expect(events[1]
|
32
|
+
expect(events[0].get("message")).to eq "hello world\n second line"
|
33
|
+
expect(events[0].get("tags")).to include("multiline")
|
34
|
+
expect(events[1].get("message")).to eq "another first line"
|
35
|
+
expect(events[1].get("tags")).to be_nil
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should allow custom tag added to multiline events" do
|
@@ -42,8 +42,8 @@ describe LogStash::Codecs::Multiline do
|
|
42
42
|
codec.flush { |e| events << e }
|
43
43
|
|
44
44
|
expect(events.size).to eq 2
|
45
|
-
expect(events[0]
|
46
|
-
expect(events[1]
|
45
|
+
expect(events[0].get("tags")).to include("hurray")
|
46
|
+
expect(events[1].get("tags")).to be_nil
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should handle new lines in messages" do
|
@@ -54,8 +54,8 @@ describe LogStash::Codecs::Multiline do
|
|
54
54
|
codec.decode(line) {|evt| events.push(evt)}
|
55
55
|
end
|
56
56
|
codec.flush { |e| events << e }
|
57
|
-
expect(events[0]
|
58
|
-
expect(events[1]
|
57
|
+
expect(events[0].get("message")).to eq "1234567890\nA234567890\nB234567890"
|
58
|
+
expect(events[1].get("message")).to eq "0987654321"
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should allow grok patterns to be used" do
|
@@ -71,7 +71,7 @@ describe LogStash::Codecs::Multiline do
|
|
71
71
|
codec.flush { |e| events << e }
|
72
72
|
|
73
73
|
insist { events.size } == 1
|
74
|
-
insist { events.first
|
74
|
+
insist { events.first.get("message") } == lines.join("\n")
|
75
75
|
end
|
76
76
|
|
77
77
|
context "using default UTF-8 charset" do
|
@@ -88,8 +88,8 @@ describe LogStash::Codecs::Multiline do
|
|
88
88
|
expect(events.size).to eq 2
|
89
89
|
|
90
90
|
events.zip(lines).each do |tuple|
|
91
|
-
expect(tuple[0]
|
92
|
-
expect(tuple[0]
|
91
|
+
expect(tuple[0].get("message")).to eq tuple[1]
|
92
|
+
expect(tuple[0].get("message").encoding.name).to eq "UTF-8"
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -106,8 +106,8 @@ describe LogStash::Codecs::Multiline do
|
|
106
106
|
expect(events.size).to eq 2
|
107
107
|
|
108
108
|
events.zip(lines).each do |tuple|
|
109
|
-
expect(tuple[0]
|
110
|
-
expect(tuple[0]
|
109
|
+
expect(tuple[0].get("message")).to eq tuple[1].inspect[1..-2]
|
110
|
+
expect(tuple[0].get("message").encoding.name).to eq "UTF-8"
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
@@ -134,8 +134,8 @@ describe LogStash::Codecs::Multiline do
|
|
134
134
|
|
135
135
|
events.zip(samples.map{|(a, b)| b}).each do |tuple|
|
136
136
|
expect(tuple[1].encoding.name).to eq "UTF-8"
|
137
|
-
expect(tuple[0]
|
138
|
-
expect(tuple[0]
|
137
|
+
expect(tuple[0].get("message")).to eq tuple[1]
|
138
|
+
expect(tuple[0].get("message").encoding.name).to eq "UTF-8"
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -160,8 +160,8 @@ describe LogStash::Codecs::Multiline do
|
|
160
160
|
|
161
161
|
events.zip(samples.map{|(a, b)| b}).each do |tuple|
|
162
162
|
expect(tuple[1].encoding.name).to eq "UTF-8"
|
163
|
-
expect(tuple[0]
|
164
|
-
expect(tuple[0]
|
163
|
+
expect(tuple[0].get("message")).to eq tuple[1]
|
164
|
+
expect(tuple[0].get("message").encoding.name).to eq "UTF-8"
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
@@ -172,7 +172,7 @@ describe LogStash::Codecs::Multiline do
|
|
172
172
|
let(:random_number_of_events) { rand(300..1000) }
|
173
173
|
let(:sample_event) { "- Sample event" }
|
174
174
|
let(:events) { decode_events }
|
175
|
-
let(:unmerged_events_count) { events.collect { |event| event
|
175
|
+
let(:unmerged_events_count) { events.collect { |event| event.get("message").split(LogStash::Codecs::Multiline::NL).size }.inject(&:+) }
|
176
176
|
|
177
177
|
context "break on maximum_lines" do
|
178
178
|
let(:max_lines) { rand(10..100) }
|
@@ -190,7 +190,7 @@ describe LogStash::Codecs::Multiline do
|
|
190
190
|
end
|
191
191
|
|
192
192
|
it "tags the event" do
|
193
|
-
expect(events.first
|
193
|
+
expect(events.first.get("tags")).to include("multiline_codec_max_lines_reached")
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
@@ -210,7 +210,7 @@ describe LogStash::Codecs::Multiline do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it "tags the event" do
|
213
|
-
expect(events.first
|
213
|
+
expect(events.first.get("tags")).to include("multiline_codec_max_bytes_reached")
|
214
214
|
end
|
215
215
|
end
|
216
216
|
end
|
data/spec/supports/helpers.rb
CHANGED
@@ -33,7 +33,7 @@ module Mlc
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def process_event(event)
|
36
|
-
event
|
36
|
+
event.set("path", path)
|
37
37
|
@queue << event
|
38
38
|
end
|
39
39
|
|
@@ -129,10 +129,10 @@ end
|
|
129
129
|
|
130
130
|
RSpec::Matchers.define(:match_path_and_line) do |path, line|
|
131
131
|
match do |actual|
|
132
|
-
actual
|
132
|
+
actual.get("path") == path && actual.get("message") == line.join($/)
|
133
133
|
end
|
134
134
|
|
135
135
|
failure_message do
|
136
|
-
"Expecting #{actual
|
136
|
+
"Expecting #{actual.get('path')} to equal `#{path}` and #{actual.get("message")} to equal #{line.join($/)}"
|
137
137
|
end
|
138
138
|
end
|
metadata
CHANGED
@@ -1,72 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-codec-multiline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core-plugin-api
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
19
|
-
name: logstash-core-plugin-api
|
20
|
-
prerelease: false
|
19
|
+
version: '2.0'
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: logstash-patterns-core
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
|
-
name: logstash-patterns-core
|
34
|
-
prerelease: false
|
35
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: jls-grok
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
45
|
- - "~>"
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: 0.11.1
|
47
|
-
name: jls-grok
|
48
|
-
prerelease: false
|
49
48
|
type: :runtime
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.11.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: logstash-devutils
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
name: logstash-devutils
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description: This gem is a
|
69
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
70
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
71
|
+
gem is not a stand-alone program
|
70
72
|
email: info@elastic.co
|
71
73
|
executables: []
|
72
74
|
extensions: []
|
@@ -93,7 +95,7 @@ licenses:
|
|
93
95
|
metadata:
|
94
96
|
logstash_plugin: 'true'
|
95
97
|
logstash_group: codec
|
96
|
-
post_install_message:
|
98
|
+
post_install_message:
|
97
99
|
rdoc_options: []
|
98
100
|
require_paths:
|
99
101
|
- lib
|
@@ -108,11 +110,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
110
|
- !ruby/object:Gem::Version
|
109
111
|
version: '0'
|
110
112
|
requirements: []
|
111
|
-
rubyforge_project:
|
112
|
-
rubygems_version: 2.
|
113
|
-
signing_key:
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.5.1
|
115
|
+
signing_key:
|
114
116
|
specification_version: 4
|
115
|
-
summary: The multiline codec will collapse multiline messages and merge them into
|
117
|
+
summary: The multiline codec will collapse multiline messages and merge them into
|
118
|
+
a single event.
|
116
119
|
test_files:
|
117
120
|
- spec/codecs/auto_flush_spec.rb
|
118
121
|
- spec/codecs/identity_map_codec_spec.rb
|