logstash-filter-dynamodb 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8dffe1ac71ebf37b039e705d45b7af56d547466
4
- data.tar.gz: 7435ef7c7fe25b654d4673fa15d751a09e5b64d1
3
+ metadata.gz: 6d69d54f93934e484bb7ff7a31cfc555626cb09b
4
+ data.tar.gz: ad51b25429f4e5f5e7498fb6940d38b13d1cb5d9
5
5
  SHA512:
6
- metadata.gz: bfba589d7d1423b262982f349661cc24661fb741a62324b6b5bd8d22fe5cde748238deef572f517a80015338760514d031bfca8f59dd8938b6e2570b1a717322
7
- data.tar.gz: 91b8856e1ca93a1105ac4af0dafc173b3820bb00a599b34cbc8e271c59b9818853a3c0b8844505b534fb6e4b31021688a90d22796a18be36b8c3bc3392fbfb91
6
+ metadata.gz: a533f991ee6607d4b45cd6fa21188f1bdd5e96a1ca150fea1d01da8382e51e2d8f629dfd81a9b55e892348779d00ff44449811a27cd152e03353528f43983fc0
7
+ data.tar.gz: d3f6204f587142d22c8508ad2181d8c5cf5c47e3b9e3d622f4c73f1098139800fbf9e0907bb35042ef7031fd1d612bcf0fa035c494ea440a766bfc042ba1d6d9
@@ -68,8 +68,18 @@ end
68
68
  def filter(event)
69
69
  doc = JSON.parse(event['message'], :symbolize_names => true)
70
70
 
71
- doc[:dynamodb][:newImage].each do |key, value|
72
- event[key.to_s] = @unmarshaller.format(value)
71
+ event['eventName'] = doc[:eventName]
72
+
73
+ keys = {}
74
+ doc[:dynamodb][:keys].each do |key, value|
75
+ keys[key.to_s] = @unmarshaller.format(value)
76
+ end
77
+ event['keys'] = keys
78
+
79
+ if doc[:dynamodb][:newImage]
80
+ doc[:dynamodb][:newImage].each do |key, value|
81
+ event[key.to_s] = @unmarshaller.format(value)
82
+ end
73
83
  end
74
84
 
75
85
  filter_matched(event)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-dynamodb'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This plugin unmarshals a DynamoDB stream message and populates the corresponding ElasticSearch fields so the get indexed properly "
6
6
  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"
@@ -11,6 +11,14 @@ describe LogStash::Filters::DynamoDB do
11
11
  end
12
12
 
13
13
  sample('message' => '{"eventID":"0","eventName":"INSERT","eventVersion":"1.0","eventSource":"aws:dynamodb","awsRegion":{},"dynamodb":{"keys":{"id":{"S":"809c2aad-bdb1-43a4-8f67-d56589e4058d"}},"newImage":{"criterias":{"SS":["a","b"]},"id":{"S":"809c2aad-bdb1-43a4-8f67-d56589e4058d"},"labels":{"M":{"foo":{"S":"bar"}}}}}}') do
14
+
15
+
16
+ expect(subject).to include("eventName")
17
+ expect(subject['eventName']).to eq('INSERT')
18
+
19
+ expect(subject).to include("keys")
20
+ expect(subject['keys']).to eq({'id' => '809c2aad-bdb1-43a4-8f67-d56589e4058d'})
21
+
14
22
  expect(subject).to include("id")
15
23
  expect(subject['id']).to eq('809c2aad-bdb1-43a4-8f67-d56589e4058d')
16
24
 
@@ -20,5 +28,13 @@ describe LogStash::Filters::DynamoDB do
20
28
  expect(subject).to include("labels")
21
29
  expect(subject['labels']).to eq({'foo' => 'bar'})
22
30
  end
31
+
32
+ sample('message' => '{"eventID":"0","eventName":"REMOVE","eventVersion":"1.0","eventSource":"aws:dynamodb","awsRegion":{},"dynamodb":{"keys":{"id":{"S":"809c2aad-bdb1-43a4-8f67-d56589e4058d"}}}}') do
33
+ expect(subject).to include("eventName")
34
+ expect(subject['eventName']).to eq('REMOVE')
35
+
36
+ expect(subject).to include("keys")
37
+ expect(subject['keys']).to eq({'id' => '809c2aad-bdb1-43a4-8f67-d56589e4058d'})
38
+ end
23
39
  end
24
40
  end
metadata CHANGED
@@ -1,58 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-dynamodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mantika
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: logstash-core
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - '>='
18
17
  - !ruby/object:Gem::Version
19
18
  version: 1.4.0
20
- - - "<"
19
+ - - <
21
20
  - !ruby/object:Gem::Version
22
21
  version: 2.0.0
23
- type: :runtime
22
+ name: logstash-core
24
23
  prerelease: false
24
+ type: :runtime
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
27
+ - - '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.4.0
30
- - - "<"
30
+ - - <
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.0.0
33
33
  - !ruby/object:Gem::Dependency
34
- name: logstash-devutils
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
- - - ">="
36
+ - - '>='
38
37
  - !ruby/object:Gem::Version
39
38
  version: '0'
40
- type: :development
39
+ name: logstash-devutils
41
40
  prerelease: false
41
+ type: :development
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
- description: This gem is a logstash plugin required to be installed on top of the
48
- Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
49
- a stand-alone program
47
+ 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
50
48
  email: info@mantika.ca
51
49
  executables: []
52
50
  extensions: []
53
51
  extra_rdoc_files: []
54
52
  files:
55
- - ".gitignore"
53
+ - .gitignore
56
54
  - CHANGELOG.md
57
55
  - CONTRIBUTORS
58
56
  - DEVELOPER.md
@@ -71,27 +69,26 @@ licenses:
71
69
  metadata:
72
70
  logstash_plugin: 'true'
73
71
  logstash_group: filter
74
- post_install_message:
72
+ post_install_message:
75
73
  rdoc_options: []
76
74
  require_paths:
77
75
  - lib
78
76
  required_ruby_version: !ruby/object:Gem::Requirement
79
77
  requirements:
80
- - - ">="
78
+ - - '>='
81
79
  - !ruby/object:Gem::Version
82
80
  version: '0'
83
81
  required_rubygems_version: !ruby/object:Gem::Requirement
84
82
  requirements:
85
- - - ">="
83
+ - - '>='
86
84
  - !ruby/object:Gem::Version
87
85
  version: '0'
88
86
  requirements: []
89
- rubyforge_project:
87
+ rubyforge_project:
90
88
  rubygems_version: 2.4.8
91
- signing_key:
89
+ signing_key:
92
90
  specification_version: 4
93
- summary: This plugin unmarshals a DynamoDB stream message and populates the corresponding
94
- ElasticSearch fields so the get indexed properly
91
+ summary: This plugin unmarshals a DynamoDB stream message and populates the corresponding ElasticSearch fields so the get indexed properly
95
92
  test_files:
96
93
  - spec/filters/dynamodb_spec.rb
97
94
  - spec/spec_helper.rb