logstash-output-cassandra 1.0.0 → 5.0.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d59e968998f2c6a341ac05c52c2d6b2c249e9e0e
|
4
|
+
data.tar.gz: 45a7bd93395ad23786d0b7b7377dbbae7cddbe10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8b7b126e8f2533ec9bb8ba915f75e63b268a66b00f662f057e004f34b9d5676e7d9320f6b61770599a3c603813028d43f1ba0f33918680a790ac2c380111a10
|
7
|
+
data.tar.gz: d07ae28d48b0ba218546c25918cc510b969c562362ae3eaf2fa69f675ad82a40e3aefb0dea84a4d419dc94922ad31e91a84a15dcbaf31b1bc85269dd75cd5f09
|
@@ -40,7 +40,7 @@ module LogStash; module Outputs; module Cassandra
|
|
40
40
|
def get_filter_transform(event)
|
41
41
|
filter_transform = nil
|
42
42
|
if @filter_transform_event_key
|
43
|
-
filter_transform = event
|
43
|
+
filter_transform = event.get(@filter_transform_event_key)
|
44
44
|
assert_filter_transform_structure(filter_transform)
|
45
45
|
elsif @filter_transform.length > 0
|
46
46
|
filter_transform = @filter_transform
|
@@ -59,7 +59,7 @@ module LogStash; module Outputs; module Cassandra
|
|
59
59
|
def add_event_value_from_filter_to_action(event, filter, action)
|
60
60
|
event_data = event.sprintf(filter['event_key'])
|
61
61
|
unless filter.fetch('expansion_only', false)
|
62
|
-
event_data = event
|
62
|
+
event_data = event.get(event_data)
|
63
63
|
end
|
64
64
|
if filter.has_key?('cassandra_type')
|
65
65
|
cassandra_type = event.sprintf(filter['cassandra_type'])
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-cassandra'
|
4
|
-
s.version = '
|
4
|
+
s.version = '5.0.0'
|
5
5
|
s.licenses = [ 'Apache License (2.0)' ]
|
6
6
|
s.summary = 'Store events into Cassandra'
|
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/plugin install gemname. This gem is not a stand-alone program'
|
@@ -20,16 +20,13 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
# Gem dependencies
|
22
22
|
s.add_runtime_dependency 'concurrent-ruby'
|
23
|
-
s.add_runtime_dependency 'logstash-core', '>=
|
23
|
+
s.add_runtime_dependency 'logstash-core-plugin-api', '>= 1.60', '<= 2.99'
|
24
24
|
s.add_runtime_dependency 'cassandra-driver', '>= 3.0.0'
|
25
|
-
s.add_development_dependency 'cabin'
|
25
|
+
s.add_development_dependency 'cabin'
|
26
26
|
s.add_development_dependency 'longshoreman'
|
27
27
|
s.add_development_dependency 'logstash-devutils'
|
28
28
|
s.add_development_dependency 'logstash-codec-plain'
|
29
29
|
s.add_development_dependency 'simplecov'
|
30
30
|
s.add_development_dependency 'simplecov-rcov'
|
31
|
-
s.add_development_dependency 'unparser', '0.2.4'
|
32
|
-
s.add_development_dependency 'metric_fu'
|
33
|
-
s.add_development_dependency 'coveralls'
|
34
31
|
s.add_development_dependency 'gems'
|
35
32
|
end
|
@@ -29,7 +29,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
29
29
|
|
30
30
|
it 'allows for string expansion in table names' do
|
31
31
|
sut_instance = sut.new(default_opts.update({ 'table' => '%{[a_field]}' }))
|
32
|
-
sample_event
|
32
|
+
sample_event.set('a_field', 'a_value')
|
33
33
|
|
34
34
|
action = sut_instance.parse(sample_event)
|
35
35
|
|
@@ -52,7 +52,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
52
52
|
describe 'properly configured' do
|
53
53
|
it 'maps the event key to the column' do
|
54
54
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column' }] }))
|
55
|
-
sample_event
|
55
|
+
sample_event.set('a_field', 'a_value')
|
56
56
|
|
57
57
|
action = sut_instance.parse(sample_event)
|
58
58
|
|
@@ -61,8 +61,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
61
61
|
|
62
62
|
it 'works with multiple filter transforms' do
|
63
63
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column' }, { 'event_key' => 'another_field', 'column_name' => 'a_different_column' }] }))
|
64
|
-
sample_event
|
65
|
-
sample_event
|
64
|
+
sample_event.set('a_field', 'a_value')
|
65
|
+
sample_event.set('another_field', 'a_second_value')
|
66
66
|
|
67
67
|
action = sut_instance.parse(sample_event)
|
68
68
|
|
@@ -72,8 +72,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
72
72
|
|
73
73
|
it 'allows for string expansion in event keys' do
|
74
74
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => '%{[pointer_to_another_field]}', 'column_name' => 'a_column' }] }))
|
75
|
-
sample_event
|
76
|
-
sample_event
|
75
|
+
sample_event.set('pointer_to_another_field', 'another_field')
|
76
|
+
sample_event.set('another_field', 'a_value')
|
77
77
|
|
78
78
|
action = sut_instance.parse(sample_event)
|
79
79
|
|
@@ -91,8 +91,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
91
91
|
|
92
92
|
it 'allows for string expansion in column names' do
|
93
93
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => '%{[pointer_to_another_field]}' }] }))
|
94
|
-
sample_event
|
95
|
-
sample_event
|
94
|
+
sample_event.set('a_field', 'a_value')
|
95
|
+
sample_event.set('pointer_to_another_field', 'a_different_column')
|
96
96
|
|
97
97
|
action = sut_instance.parse(sample_event)
|
98
98
|
|
@@ -103,7 +103,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
103
103
|
|
104
104
|
describe 'cassandra type mapping' do
|
105
105
|
[
|
106
|
-
{ :name => 'timestamp', :type => ::Cassandra::Types::Timestamp, :value => Time::parse('1979-07-27 00:00:00 +
|
106
|
+
{ :name => 'timestamp', :type => ::Cassandra::Types::Timestamp, :value => Time::parse('1979-07-27 00:00:00 +0000'), expected: Time::parse('1979-07-27 00:00:00 +0000').utc},
|
107
107
|
{ :name => 'timestamp', :type => ::Cassandra::Types::Timestamp, :value => '1982-05-04 00:00:00 +0300', expected: Time::parse('1982-05-04 00:00:00 +0300') },
|
108
108
|
{ :name => 'timestamp', :type => ::Cassandra::Types::Timestamp, :value => 1457606758, expected: Time.at(1457606758) },
|
109
109
|
{ :name => 'inet', :type => ::Cassandra::Types::Inet, :value => '0.0.0.0' },
|
@@ -123,7 +123,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
123
123
|
# NOTE: this is not the best test there is, but it is the best / simplest I could think of :/
|
124
124
|
it "properly maps #{mapping[:name]} to #{mapping[:type]}" do
|
125
125
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column', 'cassandra_type' => mapping[:name] }] }))
|
126
|
-
sample_event
|
126
|
+
sample_event.set('a_field', mapping[:value])
|
127
127
|
|
128
128
|
action = sut_instance.parse(sample_event)
|
129
129
|
|
@@ -135,7 +135,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
135
135
|
it 'properly maps sets to their specific set types' do
|
136
136
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column', 'cassandra_type' => 'set<int>' }] }))
|
137
137
|
original_value = [ 1, 2, 3 ]
|
138
|
-
sample_event
|
138
|
+
sample_event.set('a_field', original_value)
|
139
139
|
|
140
140
|
action = sut_instance.parse(sample_event)
|
141
141
|
|
@@ -145,7 +145,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
145
145
|
it 'properly maps sets to their specific set types for type which also require actual conversion' do
|
146
146
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column', 'cassandra_type' => 'set<timeuuid>' }] }))
|
147
147
|
original_value = %w(00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002)
|
148
|
-
sample_event
|
148
|
+
sample_event.set('a_field', original_value)
|
149
149
|
|
150
150
|
action = sut_instance.parse(sample_event)
|
151
151
|
|
@@ -157,8 +157,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
157
157
|
|
158
158
|
it 'allows for string expansion in cassandra types' do
|
159
159
|
sut_instance = sut.new(default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column', 'cassandra_type' => '%{[pointer_to_a_field]}' }] }))
|
160
|
-
sample_event
|
161
|
-
sample_event
|
160
|
+
sample_event.set('a_field', '123')
|
161
|
+
sample_event.set('pointer_to_a_field', 'int')
|
162
162
|
|
163
163
|
action = sut_instance.parse(sample_event)
|
164
164
|
|
@@ -168,7 +168,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
168
168
|
it 'fails in case of an unknown type' do
|
169
169
|
options = default_opts.update({ 'filter_transform' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column', 'cassandra_type' => 'what?!' }] })
|
170
170
|
sut_instance = sut.new(options)
|
171
|
-
sample_event
|
171
|
+
sample_event.set('a_field', 'a_value')
|
172
172
|
expect(options['logger']).to(receive(:error)).at_least(:once)
|
173
173
|
|
174
174
|
result = sut_instance.parse(sample_event)
|
@@ -180,8 +180,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
180
180
|
describe 'from event' do
|
181
181
|
it 'obtains the filter transform from the event if defined' do
|
182
182
|
sut_instance = sut.new(default_opts.update({ 'filter_transform_event_key' => 'an_event_filter' }))
|
183
|
-
sample_event
|
184
|
-
sample_event
|
183
|
+
sample_event.set('a_field', 'a_value')
|
184
|
+
sample_event.set('an_event_filter', [{ 'event_key' => 'a_field', 'column_name' => 'a_column' }])
|
185
185
|
|
186
186
|
action = sut_instance.parse(sample_event)
|
187
187
|
|
@@ -190,8 +190,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
190
190
|
|
191
191
|
it 'obtains the filter transform from the event even when it is in the metadata' do
|
192
192
|
sut_instance = sut.new(default_opts.update({ 'filter_transform_event_key' => '[@metadata][the_filter]' }))
|
193
|
-
sample_event
|
194
|
-
sample_event
|
193
|
+
sample_event.set('a_field', 'a_value')
|
194
|
+
sample_event.set('@metadata', { 'the_filter' => [{ 'event_key' => 'a_field', 'column_name' => 'a_column' }] })
|
195
195
|
|
196
196
|
action = sut_instance.parse(sample_event)
|
197
197
|
|
@@ -203,8 +203,8 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
203
203
|
describe 'hints' do
|
204
204
|
it 'removes fields starting with @' do
|
205
205
|
sut_instance = sut.new(default_opts.update({ 'hints' => {} }))
|
206
|
-
sample_event
|
207
|
-
sample_event
|
206
|
+
sample_event.set('leave', 'a_value')
|
207
|
+
sample_event.set('@remove', 'another_value')
|
208
208
|
|
209
209
|
action = sut_instance.parse(sample_event)
|
210
210
|
|
@@ -215,18 +215,18 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
215
215
|
it 'does not attempt to change items with no hints' do
|
216
216
|
sut_instance = sut.new(default_opts.update({ 'hints' => {} }))
|
217
217
|
expected_value = [ 1, 2, 3 ]
|
218
|
-
sample_event
|
218
|
+
sample_event.set('no_hint_here', expected_value)
|
219
219
|
|
220
220
|
action = sut_instance.parse(sample_event)
|
221
221
|
|
222
|
-
expect(action['data']['no_hint_here']).to(
|
222
|
+
expect(action['data']['no_hint_here']).to(match_array(expected_value))
|
223
223
|
end
|
224
224
|
|
225
225
|
it 'converts items with hints' do
|
226
226
|
sut_instance = sut.new(default_opts.update({ 'hints' => { 'a_set' => 'set<int>', 'an_int' => 'int' } }))
|
227
227
|
original_set = [ 1, 2, 3 ]
|
228
|
-
sample_event
|
229
|
-
sample_event
|
228
|
+
sample_event.set('a_set', original_set)
|
229
|
+
sample_event.set('an_int', '123')
|
230
230
|
|
231
231
|
action = sut_instance.parse(sample_event)
|
232
232
|
|
@@ -239,7 +239,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
239
239
|
options = default_opts.update({ 'hints' => { 'a_field' => 'not_a_real_type' } })
|
240
240
|
sut_instance = sut.new(options)
|
241
241
|
expect(options['logger']).to(receive(:error)).at_least(:once)
|
242
|
-
sample_event
|
242
|
+
sample_event.set('a_field', 'a value')
|
243
243
|
|
244
244
|
result = sut_instance.parse(sample_event)
|
245
245
|
|
@@ -250,7 +250,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
250
250
|
options = default_opts.update({ 'hints' => { 'a_field' => 'int' } })
|
251
251
|
expect(options['logger']).to(receive(:error)).at_least(:once)
|
252
252
|
sut_instance = sut.new(options)
|
253
|
-
sample_event
|
253
|
+
sample_event.set('a_field', 'i am not an int!!!')
|
254
254
|
|
255
255
|
result = sut_instance.parse(sample_event)
|
256
256
|
|
@@ -275,7 +275,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
275
275
|
options = default_opts.update({ 'ignore_bad_values' => true, 'hints' => { 'a_field' => mapping[:name] } })
|
276
276
|
expect(options['logger']).to(receive(:warn))
|
277
277
|
sut_instance = sut.new(options)
|
278
|
-
sample_event
|
278
|
+
sample_event.set('a_field', mapping[:value])
|
279
279
|
|
280
280
|
action = sut_instance.parse(sample_event)
|
281
281
|
|
@@ -287,7 +287,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
287
287
|
options = default_opts.update({ 'ignore_bad_values' => true, 'hints' => { 'a_field' => 'set<float>' } })
|
288
288
|
expect(options['logger']).to(receive(:warn))
|
289
289
|
sut_instance = sut.new(options)
|
290
|
-
sample_event
|
290
|
+
sample_event.set('a_field', 'i am not a set')
|
291
291
|
|
292
292
|
action = sut_instance.parse(sample_event)
|
293
293
|
|
@@ -298,7 +298,7 @@ RSpec.describe LogStash::Outputs::Cassandra::EventParser do
|
|
298
298
|
it 'raises an ArgumentError in case we try to default a type we dont know' do
|
299
299
|
options = default_opts.update({ 'ignore_bad_values' => true, 'hints' => { 'a_field' => 'map<float>' } })
|
300
300
|
sut_instance = sut.new(options)
|
301
|
-
sample_event
|
301
|
+
sample_event.set('a_field', 'i am not a set')
|
302
302
|
expect(options['logger']).to(receive(:error))
|
303
303
|
|
304
304
|
result = sut_instance.parse(sample_event)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-cassandra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PerimeterX
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -29,21 +29,21 @@ dependencies:
|
|
29
29
|
requirements:
|
30
30
|
- - '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
-
- -
|
32
|
+
version: '1.60'
|
33
|
+
- - <=
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
36
|
-
name: logstash-core
|
35
|
+
version: '2.99'
|
36
|
+
name: logstash-core-plugin-api
|
37
37
|
prerelease: false
|
38
38
|
type: :runtime
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
- -
|
43
|
+
version: '1.60'
|
44
|
+
- - <=
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: '2.99'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
@@ -61,17 +61,17 @@ dependencies:
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- -
|
64
|
+
- - '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0
|
66
|
+
version: '0'
|
67
67
|
name: cabin
|
68
68
|
prerelease: false
|
69
69
|
type: :development
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - '>='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0
|
74
|
+
version: '0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
@@ -142,48 +142,6 @@ dependencies:
|
|
142
142
|
- - '>='
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
requirement: !ruby/object:Gem::Requirement
|
147
|
-
requirements:
|
148
|
-
- - '='
|
149
|
-
- !ruby/object:Gem::Version
|
150
|
-
version: 0.2.4
|
151
|
-
name: unparser
|
152
|
-
prerelease: false
|
153
|
-
type: :development
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - '='
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: 0.2.4
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
requirements:
|
162
|
-
- - '>='
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
version: '0'
|
165
|
-
name: metric_fu
|
166
|
-
prerelease: false
|
167
|
-
type: :development
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - '>='
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '0'
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
requirement: !ruby/object:Gem::Requirement
|
175
|
-
requirements:
|
176
|
-
- - '>='
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
version: '0'
|
179
|
-
name: coveralls
|
180
|
-
prerelease: false
|
181
|
-
type: :development
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - '>='
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '0'
|
187
145
|
- !ruby/object:Gem::Dependency
|
188
146
|
requirement: !ruby/object:Gem::Requirement
|
189
147
|
requirements:
|