logstash-output-charrington 0.3.7 → 0.3.9

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
  SHA256:
3
- metadata.gz: 18ae186abb98be6db8aca5f0713593a0597737f516608c97ea05fca4b58537a4
4
- data.tar.gz: 9cecf3cf3ed56956fe8907032a6a2322a6c46495a8fe1fc074ac066d15b00d01
3
+ metadata.gz: e031c490f1a81f62f0a781e259ce3872712255e014e11a41fc7420e120368fd8
4
+ data.tar.gz: f54fb87f22fed7eda64e068897a2942323f08fb54dd9cac4972ce58a3ae0217e
5
5
  SHA512:
6
- metadata.gz: f661d570cf5b4d04c170253354387da2b157f132a8b8dba60a5be5b5bdb7b087f959eb0234ce28c4dae91b984ea53e0ccbeafcbd5eb97a6dbf9d40474f236acf
7
- data.tar.gz: fac3bc74393a48e88df615afe5c3451fb0d2d073c5a400ceae06ce3ca441da202324f8f964b24f6b665a627464cbece2da0b9d95badcbb78e74498384120f826
6
+ metadata.gz: eeef47c0d66f3b1533adb9eb539e4db501b190b1ac47c89b1ad71c1e12f6748b7a957fbb4f3e08c58e75d45ae50186469e871ceb7e487a7595e81901a04f1ef7
7
+ data.tar.gz: 8f8da734bb7054bf04da564032a2d17402c905e2160ed03a78dc05f35b05faf6d67312566cc278c88ca521c2f8f86ef03d9ac9d3cd42e02d096fde38f4022eb0
@@ -29,7 +29,10 @@ module Charrington
29
29
  @connection = connection
30
30
  @schema = opts[:schema].empty? ? '' : "#{opts[:schema]}."
31
31
 
32
- @table_name = "#{event_name.gsub(/[^a-z0-9]+/, "_")}"
32
+ @table_name = "#{event_name
33
+ .gsub(/[^a-z0-9]+/, "_")
34
+ .gsub(/\A_+/, "")
35
+ .gsub(/_+\z/, "")}"
33
36
 
34
37
  @columns = event.keys
35
38
  @should_retry = false
@@ -188,15 +188,15 @@ class LogStash::Outputs::Charrington < LogStash::Outputs::Base
188
188
  def get_schema(event)
189
189
  if !@schema.nil?
190
190
  @schema
191
- elsif driver == "redshift"
191
+ else
192
192
  case event.to_hash["app_name"]
193
193
  when "Web App"
194
194
  "dea_webapp"
195
- else
195
+ when "Mobile App"
196
196
  "dea_mobileapp"
197
+ else
198
+ ""
197
199
  end
198
- else
199
- ""
200
200
  end
201
201
  end
202
202
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-charrington'
3
- s.version = '0.3.7'
3
+ s.version = '0.3.9'
4
4
 
5
5
  s.licenses = ['Apache-2.0']
6
6
  s.homepage = 'https://gitlab.podium.com/engineering/analytics/logstash-output-charrington'
@@ -32,6 +32,34 @@ describe LogStash::Outputs::Charrington do
32
32
  end
33
33
  end
34
34
 
35
+ describe 'removes a trailing plus sign' do
36
+ let(:config) do
37
+ <<-CONFIG
38
+ input {
39
+ generator {
40
+ message => '{"app_name": "Web App", "event": "with plus +", "meta": { "type": "XML" } }'
41
+ codec => 'json'
42
+ count => 1
43
+ }
44
+ }
45
+
46
+ output {
47
+ charrington {
48
+ connection_string => '#{@url}'
49
+ driver_jar_path => '#{driver_path}'
50
+ }
51
+ }
52
+ CONFIG
53
+ end
54
+
55
+ it 'creates a table and inserts a record' do
56
+ drop_table('with_plus')
57
+ run_pipeline
58
+ expect(query('SELECT * FROM with_plus')).to match_array([{id: "1", app_name: "Web App", event: "with plus +", inserted_at: a_kind_of(String), :meta_type => "XML"}])
59
+ expect(query('SELECT COUNT(1) FROM with_plus').first[:count]).to eq("1")
60
+ end
61
+ end
62
+
35
63
  describe '2 event payloads with different metadata' do
36
64
  let(:config) do
37
65
  <<-CONFIG
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-charrington
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - dconger
@@ -182,8 +182,6 @@ files:
182
182
  - README.md
183
183
  - THANKS.md
184
184
  - lib/com/zaxxer/HikariCP/2.7.2/HikariCP-2.7.2.jar
185
- - lib/commons-io/commons-io/2.4/commons-io-2.4.jar
186
- - lib/de/flapdoodle/embed/de.flapdoodle.embed.process/2.0.2/de.flapdoodle.embed.process-2.0.2.jar
187
185
  - lib/logstash-output-charrington_jars.rb
188
186
  - lib/logstash/outputs/charrington.rb
189
187
  - lib/logstash/outputs/charrington/alter_postgres_table.rb
@@ -195,16 +193,9 @@ files:
195
193
  - lib/logstash/outputs/charrington/service.rb
196
194
  - lib/logstash/outputs/charrington/transform_postgres.rb
197
195
  - lib/logstash/outputs/charrington/transform_redshift.rb
198
- - lib/net/java/dev/jna/jna-platform/4.0.0/jna-platform-4.0.0.jar
199
- - lib/net/java/dev/jna/jna/4.0.0/jna-4.0.0.jar
200
- - lib/org/apache/commons/commons-compress/1.10/commons-compress-1.10.jar
201
- - lib/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar
202
196
  - lib/org/apache/logging/log4j/log4j-api/2.6.2/log4j-api-2.6.2.jar
203
197
  - lib/org/apache/logging/log4j/log4j-slf4j-impl/2.6.2/log4j-slf4j-impl-2.6.2.jar
204
- - lib/org/postgresql/postgresql/42.2.5/postgresql-42.2.5.jar
205
198
  - lib/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar
206
- - lib/ru/yandex/qatools/embed/postgresql-embedded/2.10/postgresql-embedded-2.10.jar
207
- - lib/ru/yandex/qatools/embed/postgresql-embedded/2.8/postgresql-embedded-2.8.jar
208
199
  - logstash-output-charrington.gemspec
209
200
  - spec/charrington_spec_helper.rb
210
201
  - spec/logstash-output-charrington_test_jars.rb