logstash-filter-split 3.1.1 → 3.1.2
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 +4 -4
- data/Gemfile +8 -1
- data/docs/index.asciidoc +111 -0
- data/logstash-filter-split.gemspec +2 -2
- data/spec/filters/split_spec.rb +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac465c92c547ae65d21d9e8fff888b430c86610
|
4
|
+
data.tar.gz: 8c0a31fa0b00a6cbe23f41953a0e7050d1a88072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6192819d80a89065954d3b8f77d7cf997dcf3d6ce38a57d58747832e6603f434381a57965a9655e7f6ae7dbe4c5d83005efc7ffc95b21b7e96feafa79ff0451c
|
7
|
+
data.tar.gz: 860b16e6b425cb639dce6b5cc32f40929e344b8f52168eb2457b65b5a9fa8b665700a0c05ed23e4647dce2360cd8e6d0591c4687a646850fa681b8b4038a92c9
|
data/Gemfile
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
# Specify your gem's dependencies in logstash-mass_effect.gemspec
|
4
3
|
gemspec
|
4
|
+
|
5
|
+
logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
|
6
|
+
use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
|
7
|
+
|
8
|
+
if Dir.exist?(logstash_path) && use_logstash_source
|
9
|
+
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
10
|
+
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
11
|
+
end
|
data/docs/index.asciidoc
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
:plugin: split
|
2
|
+
:type: filter
|
3
|
+
|
4
|
+
///////////////////////////////////////////
|
5
|
+
START - GENERATED VARIABLES, DO NOT EDIT!
|
6
|
+
///////////////////////////////////////////
|
7
|
+
:version: %VERSION%
|
8
|
+
:release_date: %RELEASE_DATE%
|
9
|
+
:changelog_url: %CHANGELOG_URL%
|
10
|
+
:include_path: ../../../../logstash/docs/include
|
11
|
+
///////////////////////////////////////////
|
12
|
+
END - GENERATED VARIABLES, DO NOT EDIT!
|
13
|
+
///////////////////////////////////////////
|
14
|
+
|
15
|
+
[id="plugins-{type}-{plugin}"]
|
16
|
+
|
17
|
+
=== Split filter plugin
|
18
|
+
|
19
|
+
include::{include_path}/plugin_header.asciidoc[]
|
20
|
+
|
21
|
+
==== Description
|
22
|
+
|
23
|
+
The split filter clones an event by splitting one of its fields and
|
24
|
+
placing each value resulting from the split into a clone of the original
|
25
|
+
event. The field being split can either be a string or an array.
|
26
|
+
|
27
|
+
An example use case of this filter is for taking output from the
|
28
|
+
<<plugins-inputs-exec,exec input plugin>> which emits one event for
|
29
|
+
the whole output of a command and splitting that output by newline -
|
30
|
+
making each line an event.
|
31
|
+
|
32
|
+
Split filter can also be used to split array fields in events into individual events.
|
33
|
+
A very common pattern in JSON & XML is to make use of lists to group data together.
|
34
|
+
|
35
|
+
For example, a json structure like this:
|
36
|
+
|
37
|
+
[source,js]
|
38
|
+
----------------------------------
|
39
|
+
{ field1: ...,
|
40
|
+
results: [
|
41
|
+
{ result ... },
|
42
|
+
{ result ... },
|
43
|
+
{ result ... },
|
44
|
+
...
|
45
|
+
] }
|
46
|
+
----------------------------------
|
47
|
+
|
48
|
+
The split filter can be used on the above data to create separate events for each value of `results` field
|
49
|
+
|
50
|
+
[source,js]
|
51
|
+
----------------------------------
|
52
|
+
filter {
|
53
|
+
split {
|
54
|
+
field => "results"
|
55
|
+
}
|
56
|
+
}
|
57
|
+
----------------------------------
|
58
|
+
|
59
|
+
The end result of each split is a complete copy of the event
|
60
|
+
with only the current split section of the given field changed.
|
61
|
+
|
62
|
+
[id="plugins-{type}s-{plugin}-options"]
|
63
|
+
==== Split Filter Configuration Options
|
64
|
+
|
65
|
+
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
|
66
|
+
|
67
|
+
[cols="<,<,<",options="header",]
|
68
|
+
|=======================================================================
|
69
|
+
|Setting |Input type|Required
|
70
|
+
| <<plugins-{type}s-{plugin}-field>> |<<string,string>>|No
|
71
|
+
| <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
|
72
|
+
| <<plugins-{type}s-{plugin}-terminator>> |<<string,string>>|No
|
73
|
+
|=======================================================================
|
74
|
+
|
75
|
+
Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
|
76
|
+
filter plugins.
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
[id="plugins-{type}s-{plugin}-field"]
|
81
|
+
===== `field`
|
82
|
+
|
83
|
+
* Value type is <<string,string>>
|
84
|
+
* Default value is `"message"`
|
85
|
+
|
86
|
+
The field which value is split by the terminator.
|
87
|
+
Can be a multiline message or the ID of an array.
|
88
|
+
Nested arrays are referenced like: "[object_id][array_id]"
|
89
|
+
|
90
|
+
[id="plugins-{type}s-{plugin}-target"]
|
91
|
+
===== `target`
|
92
|
+
|
93
|
+
* Value type is <<string,string>>
|
94
|
+
* There is no default value for this setting.
|
95
|
+
|
96
|
+
The field within the new event which the value is split into.
|
97
|
+
If not set, the target field defaults to split field name.
|
98
|
+
|
99
|
+
[id="plugins-{type}s-{plugin}-terminator"]
|
100
|
+
===== `terminator`
|
101
|
+
|
102
|
+
* Value type is <<string,string>>
|
103
|
+
* Default value is `"\n"`
|
104
|
+
|
105
|
+
The string to split on. This is usually a line terminator, but can be any
|
106
|
+
string. If you are splitting a JSON array into multiple events, you can ignore this field.
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
[id="plugins-{type}s-{plugin}-common-options"]
|
111
|
+
include::{include_path}/{type}.asciidoc[]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-split'
|
4
|
-
s.version = '3.1.
|
4
|
+
s.version = '3.1.2'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "The split filter is for splitting multiline messages into separate events."
|
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/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files = Dir[
|
14
|
+
s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
data/spec/filters/split_spec.rb
CHANGED
@@ -80,6 +80,11 @@ describe LogStash::Filters::Split do
|
|
80
80
|
insist { subject.is_a?(Logstash::Event) }
|
81
81
|
insist { subject.get("array") } == "big"
|
82
82
|
end
|
83
|
+
|
84
|
+
sample("array" => ["single-element"], "untouched" => "1\n2\n3") do
|
85
|
+
insist { subject.get("array") } == "single-element"
|
86
|
+
insist { subject.get("untouched") } == "1\n2\n3"
|
87
|
+
end
|
83
88
|
end
|
84
89
|
|
85
90
|
describe "split array into new field" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-split
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- LICENSE
|
57
57
|
- NOTICE.TXT
|
58
58
|
- README.md
|
59
|
+
- docs/index.asciidoc
|
59
60
|
- lib/logstash/filters/split.rb
|
60
61
|
- logstash-filter-split.gemspec
|
61
62
|
- spec/filters/split_spec.rb
|
@@ -81,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
82
|
version: '0'
|
82
83
|
requirements: []
|
83
84
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.4.8
|
85
86
|
signing_key:
|
86
87
|
specification_version: 4
|
87
88
|
summary: The split filter is for splitting multiline messages into separate events.
|