logstash-filter-csv 3.0.10 → 3.1.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 +8 -2
- data/LICENSE +199 -10
- data/README.md +1 -1
- data/VERSION +1 -1
- data/docs/index.asciidoc +23 -5
- data/lib/logstash/filters/csv.rb +12 -0
- data/logstash-filter-csv.gemspec +1 -1
- data/spec/filters/csv_spec.rb +290 -285
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61380dfaee5f7c768ba33dbeb372644941053ccf3694c441b5f6bc5b7758af46
|
4
|
+
data.tar.gz: c9a4bfd2b2a2c0f4d4ccac90ba8d01722a5ed7833294e8cb749f1b4c2685d2ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 472e1b1028701925b45aaa1990349cd6f277326e1151ba8eaacc7d48125d67528f8873c08bab7698237cdb1e35eaf39506de51623758327f91a29af36f4059f1
|
7
|
+
data.tar.gz: 0cc77c798c6fa3319f63aa4c9d56314686fa5bab7f6cbb0d6f221532e2007aacc1545235bfbe37fb3822125b62201bd78ef7fd3e6d48732e18f7d1990674db7b
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
## 3.1.0
|
2
|
+
- Add ECS support [#85](https://github.com/logstash-plugins/logstash-filter-csv/pull/85)
|
3
|
+
|
4
|
+
## 3.0.11
|
5
|
+
- [DOC] Fixed formatting to improve readability [#84](https://github.com/logstash-plugins/logstash-filter-csv/pull/84)
|
6
|
+
|
1
7
|
## 3.0.10
|
2
|
-
- Fix asciidoc formatting for example [#73](https://github.com/logstash-plugins/logstash-filter-csv/pull/73)
|
8
|
+
- [DOC] Fix asciidoc formatting for example [#73](https://github.com/logstash-plugins/logstash-filter-csv/pull/73)
|
3
9
|
|
4
10
|
## 3.0.9
|
5
|
-
- Document that the `autodetect_column_names` and `skip_header` options work only when the number of Logstash
|
11
|
+
- [DOC] Document that the `autodetect_column_names` and `skip_header` options work only when the number of Logstash
|
6
12
|
pipeline workers is set to `1`.
|
7
13
|
|
8
14
|
## 3.0.8
|
data/LICENSE
CHANGED
@@ -1,13 +1,202 @@
|
|
1
|
-
Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
|
2
1
|
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
6
5
|
|
7
|
-
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright 2020 Elastic and contributors
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Logstash Plugin
|
2
2
|
|
3
|
-
[![Travis Build Status](https://travis-ci.
|
3
|
+
[![Travis Build Status](https://travis-ci.com/logstash-plugins/logstash-filter-csv.svg)](https://travis-ci.com/logstash-plugins/logstash-filter-csv)
|
4
4
|
|
5
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
6
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0
|
1
|
+
3.1.0
|
data/docs/index.asciidoc
CHANGED
@@ -24,6 +24,12 @@ The CSV filter takes an event field containing CSV data, parses it,
|
|
24
24
|
and stores it as individual fields with optionally-specified field names.
|
25
25
|
This filter can parse data with any separator, not just commas.
|
26
26
|
|
27
|
+
[id="plugins-{type}s-{plugin}-ecs_metadata"]
|
28
|
+
==== Event Metadata and the Elastic Common Schema (ECS)
|
29
|
+
The plugin behaves the same regardless of ECS compatibility, except giving a warning when ECS is enabled and `target` isn't set.
|
30
|
+
|
31
|
+
TIP: Set the `target` option to avoid potential schema conflicts.
|
32
|
+
|
27
33
|
[id="plugins-{type}s-{plugin}-options"]
|
28
34
|
==== Csv Filter Configuration Options
|
29
35
|
|
@@ -36,6 +42,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
36
42
|
| <<plugins-{type}s-{plugin}-autogenerate_column_names>> |<<boolean,boolean>>|No
|
37
43
|
| <<plugins-{type}s-{plugin}-columns>> |<<array,array>>|No
|
38
44
|
| <<plugins-{type}s-{plugin}-convert>> |<<hash,hash>>|No
|
45
|
+
| <<plugins-{type}s-{plugin}-ecs_compatibility>> | <<string,string>>|No
|
39
46
|
| <<plugins-{type}s-{plugin}-quote_char>> |<<string,string>>|No
|
40
47
|
| <<plugins-{type}s-{plugin}-separator>> |<<string,string>>|No
|
41
48
|
| <<plugins-{type}s-{plugin}-skip_empty_columns>> |<<boolean,boolean>>|No
|
@@ -104,6 +111,18 @@ Example:
|
|
104
111
|
}
|
105
112
|
}
|
106
113
|
|
114
|
+
[id="plugins-{type}s-{plugin}-ecs_compatibility"]
|
115
|
+
===== `ecs_compatibility`
|
116
|
+
|
117
|
+
* Value type is <<string,string>>
|
118
|
+
* Supported values are:
|
119
|
+
** `disabled`: does not use ECS-compatible field names
|
120
|
+
** `v1`: uses the value in `target` as field name
|
121
|
+
|
122
|
+
Controls this plugin's compatibility with the
|
123
|
+
{ecs-ref}[Elastic Common Schema (ECS)].
|
124
|
+
See <<plugins-{type}s-{plugin}-ecs_metadata>> for detailed information.
|
125
|
+
|
107
126
|
[id="plugins-{type}s-{plugin}-quote_char"]
|
108
127
|
===== `quote_char`
|
109
128
|
|
@@ -153,10 +172,10 @@ This tag can referenced by users if they wish to cancel events using an 'if' con
|
|
153
172
|
Define whether the header should be skipped.
|
154
173
|
Defaults to false. If set to true, the header will be skipped.
|
155
174
|
Assumes that header is not repeated within further rows as such rows will also be skipped.
|
156
|
-
If skip_header is set without autodetect_column_names being set then columns should be set which
|
175
|
+
If `skip_header` is set without `autodetect_column_names` being set then columns should be set which
|
157
176
|
will result in the skipping of any row that exactly matches the specified column values.
|
158
|
-
If skip_header and autodetect_column_names are specified then columns should not be specified, in this case
|
159
|
-
autodetect_column_names will fill the columns setting in the background, from the first event seen, and any
|
177
|
+
If `skip_header` and `autodetect_column_names` are specified then columns should not be specified, in this case
|
178
|
+
`autodetect_column_names` will fill the columns setting in the background, from the first event seen, and any
|
160
179
|
subsequent values that match what was autodetected will be skipped.
|
161
180
|
|
162
181
|
Logstash pipeline workers must be set to `1` for this option to work.
|
@@ -180,6 +199,5 @@ Define target field for placing the data.
|
|
180
199
|
Defaults to writing to the root of the event.
|
181
200
|
|
182
201
|
|
183
|
-
|
184
202
|
[id="plugins-{type}s-{plugin}-common-options"]
|
185
|
-
include::{include_path}/{type}.asciidoc[]
|
203
|
+
include::{include_path}/{type}.asciidoc[]
|
data/lib/logstash/filters/csv.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/filters/base"
|
3
3
|
require "logstash/namespace"
|
4
|
+
require "logstash/plugin_mixins/ecs_compatibility_support"
|
4
5
|
|
5
6
|
require "csv"
|
6
7
|
|
@@ -8,6 +9,8 @@ require "csv"
|
|
8
9
|
# and stores it as individual fields (can optionally specify the names).
|
9
10
|
# This filter can also parse data with any separator, not just commas.
|
10
11
|
class LogStash::Filters::CSV < LogStash::Filters::Base
|
12
|
+
include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled, :v1, :v8 => :v1)
|
13
|
+
|
11
14
|
config_name "csv"
|
12
15
|
|
13
16
|
# The CSV data in the value of the `source` field will be expanded into a
|
@@ -102,6 +105,15 @@ class LogStash::Filters::CSV < LogStash::Filters::Base
|
|
102
105
|
CONVERTERS.default = lambda {|v| v}
|
103
106
|
CONVERTERS.freeze
|
104
107
|
|
108
|
+
def initialize(params)
|
109
|
+
super
|
110
|
+
if ecs_compatibility != :disabled && @target.nil?
|
111
|
+
logger.info('ECS compatibility is enabled but no ``target`` option was specified, it is recommended'\
|
112
|
+
' to set the option to avoid potential schema conflicts (if your data is ECS compliant or'\
|
113
|
+
' non-conflicting feel free to ignore this message)')
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
105
117
|
def register
|
106
118
|
# validate conversion types to be the valid ones.
|
107
119
|
bad_types = @convert.values.select do |type|
|
data/logstash-filter-csv.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
|
24
24
|
# Gem dependencies
|
25
25
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
26
|
-
|
27
26
|
s.add_development_dependency 'logstash-devutils'
|
27
|
+
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.2'
|
28
28
|
end
|
29
29
|
|
data/spec/filters/csv_spec.rb
CHANGED
@@ -1,272 +1,260 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "logstash/devutils/rspec/spec_helper"
|
3
3
|
require "logstash/filters/csv"
|
4
|
+
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
|
4
5
|
|
5
|
-
describe LogStash::Filters::CSV do
|
6
|
+
describe LogStash::Filters::CSV, :ecs_compatibility_support, :aggregate_failures do
|
7
|
+
ecs_compatibility_matrix(:disabled, :v1, :v8 => :v1) do |ecs_select|
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
subject(:plugin) { LogStash::Filters::CSV.new(config) }
|
10
|
+
let(:config) { Hash.new }
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
let(:doc) { "" }
|
13
|
+
let(:event) { LogStash::Event.new("message" => doc) }
|
12
14
|
|
13
|
-
|
15
|
+
describe "registration" do
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
it "should register" do
|
22
|
-
input = LogStash::Plugin.lookup("filter", "csv").new(config)
|
23
|
-
expect {input.register}.to raise_error(LogStash::ConfigurationError)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "receive" do
|
29
|
-
|
30
|
-
before(:each) do
|
31
|
-
plugin.register
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "all defaults" do
|
35
|
-
|
36
|
-
let(:config) { Hash.new }
|
37
|
-
|
38
|
-
let(:doc) { "big,bird,sesame street" }
|
39
|
-
|
40
|
-
it "extract all the values" do
|
41
|
-
plugin.filter(event)
|
42
|
-
expect(event.get("column1")).to eq("big")
|
43
|
-
expect(event.get("column2")).to eq("bird")
|
44
|
-
expect(event.get("column3")).to eq("sesame street")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should not mutate the source field" do
|
48
|
-
plugin.filter(event)
|
49
|
-
expect(event.get("message")).to be_kind_of(String)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "empty message" do
|
54
|
-
let(:doc) { "" }
|
55
|
-
|
56
|
-
let(:config) do
|
57
|
-
{ "skip_empty_rows" => true }
|
58
|
-
end
|
59
|
-
|
60
|
-
it "skips empty rows" do
|
61
|
-
plugin.filter(event)
|
62
|
-
expect(event.get("tags")).to include("_csvskippedemptyfield")
|
63
|
-
expect(event).not_to be_cancelled
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "custom separator" do
|
68
|
-
let(:doc) { "big,bird;sesame street" }
|
17
|
+
context "when using invalid data types" do
|
18
|
+
let(:config) do
|
19
|
+
{ "convert" => { "custom1" => "integer", "custom3" => "wrong_type" },
|
20
|
+
"columns" => ["custom1", "custom2", "custom3"] }
|
21
|
+
end
|
69
22
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
plugin.filter(event)
|
75
|
-
expect(event.get("column1")).to eq("big,bird")
|
76
|
-
expect(event.get("column2")).to eq("sesame street")
|
23
|
+
it "should register" do
|
24
|
+
input = LogStash::Plugin.lookup("filter", "csv").new(config)
|
25
|
+
expect {input.register}.to raise_error(LogStash::ConfigurationError)
|
26
|
+
end
|
77
27
|
end
|
78
28
|
end
|
79
29
|
|
80
|
-
describe "
|
81
|
-
let(:doc) { "big,bird,'sesame street'" }
|
30
|
+
describe "receive" do
|
82
31
|
|
83
|
-
|
84
|
-
|
32
|
+
before(:each) do
|
33
|
+
allow_any_instance_of(described_class).to receive(:ecs_compatibility).and_return(ecs_compatibility)
|
34
|
+
plugin.register
|
85
35
|
end
|
86
36
|
|
87
|
-
|
88
|
-
plugin.filter(event)
|
89
|
-
expect(event.get("column1")).to eq("big")
|
90
|
-
expect(event.get("column2")).to eq("bird")
|
91
|
-
expect(event.get("column3")).to eq("sesame street")
|
92
|
-
end
|
37
|
+
describe "all defaults" do
|
93
38
|
|
94
|
-
context "using the default one" do
|
95
|
-
let(:doc) { 'big,bird,"sesame, street"' }
|
96
39
|
let(:config) { Hash.new }
|
97
40
|
|
41
|
+
let(:doc) { "big,bird,sesame street" }
|
42
|
+
|
98
43
|
it "extract all the values" do
|
99
44
|
plugin.filter(event)
|
100
45
|
expect(event.get("column1")).to eq("big")
|
101
46
|
expect(event.get("column2")).to eq("bird")
|
102
|
-
expect(event.get("column3")).to eq("sesame
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context "using a null" do
|
107
|
-
let(:doc) { 'big,bird,"sesame" street' }
|
108
|
-
let(:config) do
|
109
|
-
{ "quote_char" => "\x00" }
|
47
|
+
expect(event.get("column3")).to eq("sesame street")
|
110
48
|
end
|
111
49
|
|
112
|
-
it "
|
50
|
+
it "should not mutate the source field" do
|
113
51
|
plugin.filter(event)
|
114
|
-
expect(event.get("
|
115
|
-
expect(event.get("column2")).to eq("bird")
|
116
|
-
expect(event.get("column3")).to eq('"sesame" street')
|
52
|
+
expect(event.get("message")).to be_kind_of(String)
|
117
53
|
end
|
118
54
|
end
|
119
|
-
|
120
|
-
|
121
|
-
let(:doc) {
|
55
|
+
|
56
|
+
describe "empty message" do
|
57
|
+
let(:doc) { "" }
|
58
|
+
|
122
59
|
let(:config) do
|
123
|
-
{ "
|
60
|
+
{ "skip_empty_rows" => true }
|
124
61
|
end
|
125
62
|
|
126
|
-
it "
|
63
|
+
it "skips empty rows" do
|
127
64
|
plugin.filter(event)
|
128
|
-
expect(event.get("
|
129
|
-
expect(event
|
130
|
-
expect(event.get("column3")).to eq('"sesame" street')
|
65
|
+
expect(event.get("tags")).to include("_csvskippedemptyfield")
|
66
|
+
expect(event).not_to be_cancelled
|
131
67
|
end
|
132
68
|
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe "given column names" do
|
136
|
-
let(:doc) { "big,bird,sesame street" }
|
137
|
-
let(:config) do
|
138
|
-
{ "columns" => ["first", "last", "address" ] }
|
139
|
-
end
|
140
|
-
|
141
|
-
it "extract all the values" do
|
142
|
-
plugin.filter(event)
|
143
|
-
expect(event.get("first")).to eq("big")
|
144
|
-
expect(event.get("last")).to eq("bird")
|
145
|
-
expect(event.get("address")).to eq("sesame street")
|
146
|
-
end
|
147
69
|
|
148
|
-
|
70
|
+
describe "custom separator" do
|
71
|
+
let(:doc) { "big,bird;sesame street" }
|
149
72
|
|
150
|
-
let(:doc) { "val1,val2,val3" }
|
151
73
|
let(:config) do
|
152
|
-
{
|
153
|
-
"columns" => ["custom1", "custom2"] }
|
74
|
+
{ "separator" => ";" }
|
154
75
|
end
|
155
|
-
|
156
76
|
it "extract all the values" do
|
157
77
|
plugin.filter(event)
|
158
|
-
expect(event.get("
|
159
|
-
expect(event.get("
|
160
|
-
expect(event.get("column3")).to be_falsey
|
78
|
+
expect(event.get("column1")).to eq("big,bird")
|
79
|
+
expect(event.get("column2")).to eq("sesame street")
|
161
80
|
end
|
162
81
|
end
|
163
82
|
|
83
|
+
describe "quote char" do
|
84
|
+
let(:doc) { "big,bird,'sesame street'" }
|
164
85
|
|
165
|
-
context "parse csv and skip the header" do
|
166
|
-
|
167
|
-
let(:doc) { "first_column,second_column,third_column" }
|
168
86
|
let(:config) do
|
169
|
-
{ "
|
170
|
-
"columns" => ["first_column", "second_column", "third_column"] }
|
87
|
+
{ "quote_char" => "'"}
|
171
88
|
end
|
172
89
|
|
173
|
-
it "
|
90
|
+
it "extract all the values" do
|
174
91
|
plugin.filter(event)
|
175
|
-
expect(event).to
|
92
|
+
expect(event.get("column1")).to eq("big")
|
93
|
+
expect(event.get("column2")).to eq("bird")
|
94
|
+
expect(event.get("column3")).to eq("sesame street")
|
176
95
|
end
|
177
|
-
end
|
178
96
|
|
179
|
-
|
97
|
+
context "using the default one" do
|
98
|
+
let(:doc) { 'big,bird,"sesame, street"' }
|
99
|
+
let(:config) { Hash.new }
|
180
100
|
|
181
|
-
|
101
|
+
it "extract all the values" do
|
102
|
+
plugin.filter(event)
|
103
|
+
expect(event.get("column1")).to eq("big")
|
104
|
+
expect(event.get("column2")).to eq("bird")
|
105
|
+
expect(event.get("column3")).to eq("sesame, street")
|
106
|
+
end
|
107
|
+
end
|
182
108
|
|
183
|
-
|
184
|
-
{ "
|
185
|
-
|
186
|
-
"
|
109
|
+
context "using a null" do
|
110
|
+
let(:doc) { 'big,bird,"sesame" street' }
|
111
|
+
let(:config) do
|
112
|
+
{ "quote_char" => "\x00" }
|
113
|
+
end
|
114
|
+
|
115
|
+
it "extract all the values" do
|
116
|
+
plugin.filter(event)
|
117
|
+
expect(event.get("column1")).to eq("big")
|
118
|
+
expect(event.get("column2")).to eq("bird")
|
119
|
+
expect(event.get("column3")).to eq('"sesame" street')
|
120
|
+
end
|
187
121
|
end
|
188
122
|
|
189
|
-
|
123
|
+
context "using a null as read from config" do
|
124
|
+
let(:doc) { 'big,bird,"sesame" street' }
|
125
|
+
let(:config) do
|
126
|
+
{ "quote_char" => "\\x00" }
|
127
|
+
end
|
190
128
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
129
|
+
it "extract all the values" do
|
130
|
+
plugin.filter(event)
|
131
|
+
expect(event.get("column1")).to eq("big")
|
132
|
+
expect(event.get("column2")).to eq("bird")
|
133
|
+
expect(event.get("column3")).to eq('"sesame" street')
|
134
|
+
end
|
196
135
|
end
|
197
136
|
end
|
198
137
|
|
199
|
-
|
200
|
-
let(:doc) { "
|
138
|
+
describe "given column names" do
|
139
|
+
let(:doc) { "big,bird,sesame street" }
|
201
140
|
let(:config) do
|
202
|
-
{ "columns" => ["
|
141
|
+
{ "columns" => ["first", "last", "address" ] }
|
203
142
|
end
|
204
143
|
|
205
144
|
it "extract all the values" do
|
206
145
|
plugin.filter(event)
|
207
|
-
expect(event.get("
|
208
|
-
expect(event.get("
|
209
|
-
expect(event.get("
|
146
|
+
expect(event.get("first")).to eq("big")
|
147
|
+
expect(event.get("last")).to eq("bird")
|
148
|
+
expect(event.get("address")).to eq("sesame street")
|
210
149
|
end
|
211
|
-
end
|
212
150
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
"
|
151
|
+
context "parse csv without autogeneration of names" do
|
152
|
+
|
153
|
+
let(:doc) { "val1,val2,val3" }
|
154
|
+
let(:config) do
|
155
|
+
{ "autogenerate_column_names" => false,
|
156
|
+
"columns" => ["custom1", "custom2"] }
|
157
|
+
end
|
158
|
+
|
159
|
+
it "extract all the values" do
|
160
|
+
plugin.filter(event)
|
161
|
+
expect(event.get("custom1")).to eq("val1")
|
162
|
+
expect(event.get("custom2")).to eq("val2")
|
163
|
+
expect(event.get("column3")).to be_falsey
|
164
|
+
end
|
218
165
|
end
|
219
|
-
let(:event) { LogStash::Event.new("datafield" => doc) }
|
220
166
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
167
|
+
|
168
|
+
context "parse csv and skip the header" do
|
169
|
+
|
170
|
+
let(:doc) { "first_column,second_column,third_column" }
|
171
|
+
let(:config) do
|
172
|
+
{ "skip_header" => true,
|
173
|
+
"columns" => ["first_column", "second_column", "third_column"] }
|
174
|
+
end
|
175
|
+
|
176
|
+
it "expects the event to be cancelled" do
|
177
|
+
plugin.filter(event)
|
178
|
+
expect(event).to be_cancelled
|
179
|
+
end
|
226
180
|
end
|
227
|
-
end
|
228
181
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
182
|
+
context "parse csv skipping empty columns" do
|
183
|
+
|
184
|
+
let(:doc) { "val1,,val3" }
|
185
|
+
|
186
|
+
let(:config) do
|
187
|
+
{ "skip_empty_columns" => true,
|
188
|
+
"source" => "datafield",
|
189
|
+
"columns" => ["custom1", "custom2", "custom3"] }
|
190
|
+
end
|
191
|
+
|
192
|
+
let(:event) { LogStash::Event.new("datafield" => doc) }
|
193
|
+
|
194
|
+
it "extract all the values" do
|
195
|
+
plugin.filter(event)
|
196
|
+
expect(event.get("custom1")).to eq("val1")
|
197
|
+
expect(event.get("custom2")).to be_falsey
|
198
|
+
expect(event.get("custom3")).to eq("val3")
|
199
|
+
end
|
235
200
|
end
|
236
201
|
|
237
|
-
|
202
|
+
context "parse csv with more data than defined" do
|
203
|
+
let(:doc) { "val1,val2,val3" }
|
204
|
+
let(:config) do
|
205
|
+
{ "columns" => ["custom1", "custom2"] }
|
206
|
+
end
|
238
207
|
|
239
|
-
|
240
|
-
|
208
|
+
it "extract all the values" do
|
209
|
+
plugin.filter(event)
|
210
|
+
expect(event.get("custom1")).to eq("val1")
|
211
|
+
expect(event.get("custom2")).to eq("val2")
|
212
|
+
expect(event.get("column3")).to eq("val3")
|
213
|
+
end
|
241
214
|
end
|
242
215
|
|
243
|
-
|
244
|
-
|
216
|
+
context "parse csv from a given source" do
|
217
|
+
let(:doc) { "val1,val2,val3" }
|
218
|
+
let(:config) do
|
219
|
+
{ "source" => "datafield",
|
220
|
+
"columns" => ["custom1", "custom2", "custom3"] }
|
221
|
+
end
|
222
|
+
let(:event) { LogStash::Event.new("datafield" => doc) }
|
223
|
+
|
224
|
+
it "extract all the values" do
|
225
|
+
plugin.filter(event)
|
226
|
+
expect(event.get("custom1")).to eq("val1")
|
227
|
+
expect(event.get("custom2")).to eq("val2")
|
228
|
+
expect(event.get("custom3")).to eq("val3")
|
229
|
+
end
|
245
230
|
end
|
246
|
-
end
|
247
|
-
end
|
248
231
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
232
|
+
context "that use [@metadata]" do
|
233
|
+
let(:metadata_field) { "[@metadata][one]" }
|
234
|
+
let(:config) do
|
235
|
+
{
|
236
|
+
"columns" => [ metadata_field, "foo" ]
|
237
|
+
}
|
238
|
+
end
|
239
|
+
|
240
|
+
let(:event) { LogStash::Event.new("message" => "hello,world") }
|
241
|
+
|
242
|
+
before do
|
243
|
+
plugin.filter(event)
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should work correctly" do
|
247
|
+
expect(event.get(metadata_field)).to eq("hello")
|
248
|
+
end
|
249
|
+
end
|
261
250
|
end
|
262
251
|
|
263
|
-
|
252
|
+
describe "givin target" do
|
264
253
|
let(:config) do
|
265
|
-
{
|
266
|
-
"target" => "data" }
|
254
|
+
{ "target" => "data" }
|
267
255
|
end
|
268
|
-
let(:event) { LogStash::Event.new("datain" => doc) }
|
269
256
|
let(:doc) { "big,bird,sesame street" }
|
257
|
+
let(:event) { LogStash::Event.new("message" => doc) }
|
270
258
|
|
271
259
|
it "extract all the values" do
|
272
260
|
plugin.filter(event)
|
@@ -274,135 +262,152 @@ describe LogStash::Filters::CSV do
|
|
274
262
|
expect(event.get("data")["column2"]).to eq("bird")
|
275
263
|
expect(event.get("data")["column3"]).to eq("sesame street")
|
276
264
|
end
|
277
|
-
end
|
278
|
-
|
279
|
-
context "which uses [nested][fieldref] syntax" do
|
280
|
-
let(:target) { "[foo][bar]" }
|
281
|
-
let(:config) do
|
282
|
-
{
|
283
|
-
"target" => target
|
284
|
-
}
|
285
|
-
end
|
286
|
-
|
287
|
-
let(:event) { LogStash::Event.new("message" => "hello,world") }
|
288
|
-
|
289
|
-
before do
|
290
|
-
plugin.filter(event)
|
291
|
-
end
|
292
265
|
|
293
|
-
|
294
|
-
|
295
|
-
|
266
|
+
context "when having also source" do
|
267
|
+
let(:config) do
|
268
|
+
{ "source" => "datain",
|
269
|
+
"target" => "data" }
|
270
|
+
end
|
271
|
+
let(:event) { LogStash::Event.new("datain" => doc) }
|
272
|
+
let(:doc) { "big,bird,sesame street" }
|
273
|
+
|
274
|
+
it "extract all the values" do
|
275
|
+
plugin.filter(event)
|
276
|
+
expect(event.get("data")["column1"]).to eq("big")
|
277
|
+
expect(event.get("data")["column2"]).to eq("bird")
|
278
|
+
expect(event.get("data")["column3"]).to eq("sesame street")
|
279
|
+
end
|
296
280
|
end
|
297
281
|
|
298
|
-
context "
|
282
|
+
context "which uses [nested][fieldref] syntax" do
|
283
|
+
let(:target) { "[foo][bar]" }
|
299
284
|
let(:config) do
|
300
285
|
{
|
301
|
-
"target" => target
|
302
|
-
"columns" => [ "[test][one]", "[test][two]" ]
|
286
|
+
"target" => target
|
303
287
|
}
|
304
288
|
end
|
305
289
|
|
290
|
+
let(:event) { LogStash::Event.new("message" => "hello,world") }
|
291
|
+
|
292
|
+
before do
|
293
|
+
plugin.filter(event)
|
294
|
+
end
|
295
|
+
|
306
296
|
it "should set fields correctly in the target" do
|
307
|
-
expect(event.get("#{target}[
|
308
|
-
expect(event.get("#{target}[
|
297
|
+
expect(event.get("#{target}[column1]")).to eq("hello")
|
298
|
+
expect(event.get("#{target}[column2]")).to eq("world")
|
299
|
+
end
|
300
|
+
|
301
|
+
context "with nested fieldrefs as columns" do
|
302
|
+
let(:config) do
|
303
|
+
{
|
304
|
+
"target" => target,
|
305
|
+
"columns" => [ "[test][one]", "[test][two]" ]
|
306
|
+
}
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should set fields correctly in the target" do
|
310
|
+
expect(event.get("#{target}[test][one]")).to eq("hello")
|
311
|
+
expect(event.get("#{target}[test][two]")).to eq("world")
|
312
|
+
end
|
309
313
|
end
|
310
|
-
end
|
311
314
|
|
315
|
+
end
|
312
316
|
end
|
313
|
-
end
|
314
317
|
|
315
|
-
|
318
|
+
describe "using field convertion" do
|
316
319
|
|
317
|
-
|
318
|
-
|
320
|
+
let(:config) do
|
321
|
+
{
|
319
322
|
"convert" => {
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
323
|
+
"column1" => "integer",
|
324
|
+
"column3" => "boolean",
|
325
|
+
"column4" => "float",
|
326
|
+
"column5" => "date",
|
327
|
+
"column6" => "date_time",
|
328
|
+
"column7" => "date",
|
329
|
+
"column8" => "date_time",
|
327
330
|
}
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
331
|
+
}
|
332
|
+
end
|
333
|
+
# 2017-06-01,2001-02-03T04:05:06+07:00
|
334
|
+
let(:doc) { "1234,bird,false,3.14159265359,2017-06-01,2001-02-03 04:05:06,invalid_date,invalid_date_time" }
|
335
|
+
let(:event) { LogStash::Event.new("message" => doc) }
|
333
336
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
337
|
+
it "converts to integer" do
|
338
|
+
plugin.filter(event)
|
339
|
+
expect(event.get("column1")).to eq(1234)
|
340
|
+
end
|
338
341
|
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
342
|
+
it "does not convert without converter" do
|
343
|
+
plugin.filter(event)
|
344
|
+
expect(event.get("column2")).to eq("bird")
|
345
|
+
end
|
343
346
|
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
347
|
+
it "converts to boolean" do
|
348
|
+
plugin.filter(event)
|
349
|
+
expect(event.get("column3")).to eq(false)
|
350
|
+
end
|
348
351
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
352
|
+
it "converts to float" do
|
353
|
+
plugin.filter(event)
|
354
|
+
expect(event.get("column4")).to eq(3.14159265359)
|
355
|
+
end
|
353
356
|
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
357
|
+
it "converts to date" do
|
358
|
+
plugin.filter(event)
|
359
|
+
expect(event.get("column5")).to be_a(LogStash::Timestamp)
|
360
|
+
expect(event.get("column5").to_s).to eq(LogStash::Timestamp.new(Date.parse("2017-06-01").to_time).to_s)
|
361
|
+
end
|
359
362
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
363
|
+
it "converts to date_time" do
|
364
|
+
plugin.filter(event)
|
365
|
+
expect(event.get("column6")).to be_a(LogStash::Timestamp)
|
366
|
+
expect(event.get("column6").to_s).to eq(LogStash::Timestamp.new(DateTime.parse("2001-02-03 04:05:06").to_time).to_s)
|
367
|
+
end
|
365
368
|
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
369
|
+
it "tries to converts to date but return original" do
|
370
|
+
plugin.filter(event)
|
371
|
+
expect(event.get("column7")).to eq("invalid_date")
|
372
|
+
end
|
370
373
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
374
|
+
it "tries to converts to date_time but return original" do
|
375
|
+
plugin.filter(event)
|
376
|
+
expect(event.get("column8")).to eq("invalid_date_time")
|
377
|
+
end
|
378
|
+
|
379
|
+
context "when using column names" do
|
375
380
|
|
376
|
-
|
381
|
+
let(:config) do
|
382
|
+
{ "convert" => { "custom1" => "integer", "custom3" => "boolean" },
|
383
|
+
"columns" => ["custom1", "custom2", "custom3"] }
|
384
|
+
end
|
385
|
+
|
386
|
+
it "get converted values to the expected type" do
|
387
|
+
plugin.filter(event)
|
388
|
+
expect(event.get("custom1")).to eq(1234)
|
389
|
+
expect(event.get("custom2")).to eq("bird")
|
390
|
+
expect(event.get("custom3")).to eq(false)
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
377
394
|
|
395
|
+
describe "given autodetect option" do
|
396
|
+
let(:header) { LogStash::Event.new("message" => "first,last,address") }
|
397
|
+
let(:doc) { "big,bird,sesame street" }
|
378
398
|
let(:config) do
|
379
|
-
{ "
|
380
|
-
"columns" => ["custom1", "custom2", "custom3"] }
|
399
|
+
{ "autodetect_column_names" => true }
|
381
400
|
end
|
382
401
|
|
383
|
-
it "
|
402
|
+
it "extract all the values with the autodetected header" do
|
403
|
+
plugin.filter(header)
|
384
404
|
plugin.filter(event)
|
385
|
-
expect(event.get("
|
386
|
-
expect(event.get("
|
387
|
-
expect(event.get("
|
405
|
+
expect(event.get("first")).to eq("big")
|
406
|
+
expect(event.get("last")).to eq("bird")
|
407
|
+
expect(event.get("address")).to eq("sesame street")
|
388
408
|
end
|
389
409
|
end
|
390
410
|
end
|
391
411
|
|
392
|
-
describe "given autodetect option" do
|
393
|
-
let(:header) { LogStash::Event.new("message" => "first,last,address") }
|
394
|
-
let(:doc) { "big,bird,sesame street" }
|
395
|
-
let(:config) do
|
396
|
-
{ "autodetect_column_names" => true }
|
397
|
-
end
|
398
|
-
|
399
|
-
it "extract all the values with the autodetected header" do
|
400
|
-
plugin.filter(header)
|
401
|
-
plugin.filter(event)
|
402
|
-
expect(event.get("first")).to eq("big")
|
403
|
-
expect(event.get("last")).to eq("bird")
|
404
|
-
expect(event.get("address")).to eq("sesame street")
|
405
|
-
end
|
406
|
-
end
|
407
412
|
end
|
408
413
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-csv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
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: 2021-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.2'
|
53
|
+
name: logstash-mixin-ecs_compatibility_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.2'
|
47
61
|
description: This gem is a Logstash plugin required to be installed on top of the
|
48
62
|
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
49
63
|
gem is not a stand-alone program
|