logstash-output-charrington 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: d9e0b78caecf406a5c26c0c433a9e9e03361ca64110e5380333ecbb1b7e14c53
4
- data.tar.gz: 97b48b44372f9f44463c608d03d9362984ccaded87257e5938bed056ac7c6bc2
3
+ metadata.gz: bc7913c9e276dc1f40fa722cb271f21d0e19ab3270b7fbd854cc7057c6a50bc3
4
+ data.tar.gz: 4be9c45b7e08e2ef3ab84b07109096305cfcc33a84b3cc9625292d8e572bf86b
5
5
  SHA512:
6
- metadata.gz: 7a8d64b4f5cc6de22d26297477ca3561af1d9cde45dbcc32f7ad785f9485b490780832698265402ad7bb9291b164ea06ca57fd4aaa18968ce1eefe3848590bd5
7
- data.tar.gz: 5a79965fad327dc2588ea45b4b6eae8c8a1c2393e28cc7f02e76eb6e1100688405f454e2a0d2d4966330483899bbb217cddd3cb1e0992204de8f57ca95edd430
6
+ metadata.gz: 13ed00f23566b13bd75c3935154d0c57336fe0be4e5ea1f80a0a529b068468159863fcd564e4f0ce730645d2a8ffe49d467f86fa6c0addd8b7fa8ac8b525e45a
7
+ data.tar.gz: 242d0f1f8174e627f45d32924f7864d78969cb92f2f20141b9311a02e5d1cb329c9c4b13b62b79c60bb252df0df3fdb0d4eeed492609ddc0ba2e00d4a1176739
data/README.md CHANGED
@@ -63,6 +63,7 @@ For development:
63
63
  | retry_sql_states | Array of strings | An array of custom SQL state codes you wish to retry until `max_flush_exceptions`. Useful if you're using a JDBC driver which returns retry-able, but non-standard SQL state codes in it's exceptions. | No | [] |
64
64
  | event_as_json_keyword | String | The magic key word that the plugin looks for to convert the entire event into a JSON object. As Logstash does not support this out of the box with it's `sprintf` implementation, you can use whatever this field is set to in the statement parameters | No | @event |
65
65
  | enable_event_as_json_keyword | Boolean | Enables the magic keyword set in the configuration option `event_as_json_keyword`. Without this enabled the plugin will not convert the `event_as_json_keyword` into JSON encoding of the entire event. | No | False |
66
+ | schema | String | Database schema | No | False |
66
67
 
67
68
  ## Example configurations
68
69
  Example logstash configurations, can now be found in the examples directory. Where possible we try to link every configuration with a tested jar.
@@ -107,6 +107,9 @@ class LogStash::Outputs::Charrington < LogStash::Outputs::Base
107
107
  # The magic key used to convert the whole event to JSON. If you need this, and you have the default in your events, you can use this to change your magic keyword.
108
108
  config :event_as_json_keyword, validate: :string, default: '@event'
109
109
 
110
+ # The database schema
111
+ config :schema, validate: :string, default: ''
112
+
110
113
  def register
111
114
  @logger.info('JDBC - Starting up')
112
115
 
@@ -214,10 +217,13 @@ class LogStash::Outputs::Charrington < LogStash::Outputs::Base
214
217
  end
215
218
 
216
219
  def create_table_name(event)
217
- if event.nil? || event.to_hash["event"].nil?
218
- raise TableNameNil.new("Table name is nil", event)
219
- end
220
- event.to_hash["event"].to_s.strip.gsub(/[ -]+/, "_").downcase
220
+ raise TableNameNil.new("Table name is nil", event) if event.nil?
221
+
222
+ event = event.to_hash["event"].to_s.strip
223
+ raise TableNameNil.new("Table name is nil", event) if event.empty?
224
+
225
+ schema = @schema.empty? ? '' : "#{@schema}."
226
+ "#{schema}#{event.gsub(/[ \-_]+/, "_").downcase}"
221
227
  end
222
228
 
223
229
  def prepared_statement(keys)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-charrington'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = 'This plugin allows you to output to SQL, via JDBC'
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/logstash-plugin install 'logstash-output-charrington'. This gem is not a stand-alone program"
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dconger