logstash-output-custom-solr 0.1.15 → 0.1.16

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: c6c318ef5f8b97e59650adee93ba204fac066e7ff782cb7ccecb72e6594ccc82
4
- data.tar.gz: f8ab3d9b5666f1aa08ab47c4629c03fca2caf3f01a7e708b162d38dca4e38515
3
+ metadata.gz: 067dabce97cb87c1e73c9a4d73f2d51a7fbc75d67f0c26a8578c11ddba82536f
4
+ data.tar.gz: 0dcfc3a358c9b3a8811cd07f973de433b2fb69024f203bb9114114820d36001b
5
5
  SHA512:
6
- metadata.gz: 41430e772bb847355f0f6c72a5d5576c6fec02cc05d560d7a911d735a8c3b7f9093454b33060953f512049160f9c67ed5c88e9e7295e60a16570a9bcbfa332bf
7
- data.tar.gz: 3e84ef77f7fb5ab593c418a24f16ad4384805650cb45ddeb30d08b5d3c6048d8321af586d091b96b9c05db487c3d8a4b68554271a7c5c96ebea75078d016488a
6
+ metadata.gz: fec62c2f3651d6acd88e18e1fdae79ceddbcea74fb3b1ef0302c682ca088dc5c9e1ddfa18bfd3d6e4a85a93e03dc931dab3a1067c3642697cc9e8fd285b180be
7
+ data.tar.gz: 9f5a5cf1a0fec21932b44731017c6f017b1bc3269451d59878191a2a134cf8d9f1466124b2b91325bc07d350c48e2d290e77e1ed1ec1103dbaed7dfa4ba2b634
@@ -55,15 +55,16 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
55
55
  @mode = MODE_SOLRCLOUD
56
56
  end
57
57
 
58
- @solr = nil
58
+ @solr_std = {}
59
+ @solr_cloud = nil
59
60
  @zk = nil
60
61
 
61
62
  if @mode == MODE_STANDALONE then
62
- @solr = RSolr.connect :url => @url
63
+ @solr_std[@collection] = RSolr.connect :url => @url
63
64
  elsif @mode == MODE_SOLRCLOUD then
64
65
  @zk = ZK.new(@zk_host)
65
66
  cloud_connection = RSolr::Cloud::Connection.new(@zk)
66
- @solr = RSolr::Client.new(cloud_connection, read_timeout: 60, open_timeout: 60)
67
+ @solr_cloud = RSolr::Client.new(cloud_connection, read_timeout: 60, open_timeout: 60)
67
68
  end
68
69
 
69
70
  buffer_initialize(
@@ -96,14 +97,10 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
96
97
  @logger.info 'Record: %s' % document.inspect
97
98
 
98
99
  collection = @collection
99
-
100
- @logger.info 'collection_field: %s' % @collection_field
101
- @logger.info 'has_key?: %s' % document.has_key?(@collection_field).to_s
102
100
  if @collection_field and document.has_key?(@collection_field) then
103
101
  collection = document[@collection_field]
104
102
  document.delete(@collection_field)
105
103
  end
106
- @logger.info 'Collection: %s' % collection
107
104
 
108
105
  documents = documents_per_col.fetch(collection, [])
109
106
  documents.push(document)
@@ -118,10 +115,12 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
118
115
 
119
116
  documents_per_col.each do |collection, documents|
120
117
  if @mode == MODE_STANDALONE then
121
- @solr.add documents, :params => params
122
- @logger.info 'Added %d document(s) to Solr' % documents.count
118
+ collection_url = @url.rpartition('/')[0] + '/' + collection
119
+ @solr_std[collection] ||= RSolr.connect :url => collection_url
120
+ @solr_std[collection].add documents, :params => params
121
+ @logger.info 'Added %d document(s) to Solr at "%s"' % [documents.count, collection_url]
123
122
  elsif @mode == MODE_SOLRCLOUD then
124
- @solr.add documents, collection: collection, :params => params
123
+ @solr_cloud.add documents, collection: collection, :params => params
125
124
  @logger.info 'Added %d document(s) to "%s" collection' % [documents.count, collection]
126
125
  end
127
126
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-custom-solr'
3
- s.version = "0.1.15"
3
+ s.version = "0.1.16"
4
4
  s.licenses = ["Apache License (2.0)"]
5
5
  s.summary = "Logstash output plugin for sending data to Solr."
6
6
  s.description = "Logstash output plugin for sending data to Solr. It supports SolrCloud, not only Standalone Solr."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-custom-solr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minoru Osuka