logstash-output-custom-solr 0.1.15 → 0.1.16
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 +4 -4
- data/lib/logstash/outputs/solr.rb +9 -10
- data/logstash-output-custom-solr.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 067dabce97cb87c1e73c9a4d73f2d51a7fbc75d67f0c26a8578c11ddba82536f
|
4
|
+
data.tar.gz: 0dcfc3a358c9b3a8811cd07f973de433b2fb69024f203bb9114114820d36001b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
@
|
58
|
+
@solr_std = {}
|
59
|
+
@solr_cloud = nil
|
59
60
|
@zk = nil
|
60
61
|
|
61
62
|
if @mode == MODE_STANDALONE then
|
62
|
-
@
|
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
|
-
@
|
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
|
-
@
|
122
|
-
@
|
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
|
-
@
|
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.
|
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."
|