logstash-output-custom-solr 0.1.12 → 0.1.13
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 +5 -2
- data/logstash-output-custom-solr.gemspec +1 -1
- data/spec/outputs/solr_spec.rb +46 -0
- 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: bb4053e38740dc0fe90a2087dc117a65da30a594efa1c62ef4ac3b704212fd3f
|
4
|
+
data.tar.gz: 89fe6f0255d7d0dd5dc0b0487a82da3b0000a9bfb6a53c8956948ffee9a096d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09fa19c7d95edcb8deb887b08f72c96804687f16ca25404a6c763b7dacc1c8be1bccf1f30f1f98053103944c04ff00a840287730afd18a66a2920600a048a305'
|
7
|
+
data.tar.gz: 34ce09678366e8a75c1e72cbc614b85a8bb758e259ac8b8d9acc1aecdf794f501a5c7454f407f0a15a8adc75d02a6df862def9f080c7bdff6f92a76e8fb2ea8f
|
@@ -94,13 +94,16 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
|
|
94
94
|
end
|
95
95
|
|
96
96
|
@logger.info 'Record: %s' % document.inspect
|
97
|
+
|
98
|
+
collection = @collection
|
97
99
|
|
100
|
+
@logger.info 'collection_field: %s' % @collection_field
|
101
|
+
@logger.info 'has_key?: %s' % document.has_key?(@collection_field).to_s
|
98
102
|
if @collection_field and document.has_key?(@collection_field) then
|
99
103
|
collection = document[@collection_field]
|
100
104
|
document.delete(@collection_field)
|
101
|
-
else
|
102
|
-
collection = @collection
|
103
105
|
end
|
106
|
+
@logger.info 'Collection: %s' % collection
|
104
107
|
|
105
108
|
documents = documents_per_col.fetch(collection, [])
|
106
109
|
documents.push(document)
|
@@ -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.13"
|
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."
|
data/spec/outputs/solr_spec.rb
CHANGED
@@ -154,6 +154,52 @@ describe LogStash::Outputs::Solr do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
+
describe 'multiple_collections' do
|
158
|
+
before do
|
159
|
+
start_zookeeper
|
160
|
+
end
|
161
|
+
|
162
|
+
after do
|
163
|
+
stop_zookeeper
|
164
|
+
end
|
165
|
+
|
166
|
+
let(:config) {
|
167
|
+
{
|
168
|
+
'zk_host' => 'localhost:3292/solr',
|
169
|
+
'collection_field' => 'collection',
|
170
|
+
'flush_size' => 100
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
let(:sample_record1) {
|
175
|
+
{
|
176
|
+
'id' => 'test1',
|
177
|
+
'collection' => 'col1'
|
178
|
+
}
|
179
|
+
}
|
180
|
+
let(:sample_record2) {
|
181
|
+
{
|
182
|
+
'id' => 'test2',
|
183
|
+
'collection' => 'col2'
|
184
|
+
}
|
185
|
+
}
|
186
|
+
let(:sample_record3) {
|
187
|
+
{
|
188
|
+
'id' => 'test3'
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
it 'receive' do
|
193
|
+
output = LogStash::Outputs::Solr.new(config)
|
194
|
+
output.register
|
195
|
+
|
196
|
+
output.receive(sample_record1)
|
197
|
+
output.receive(sample_record2)
|
198
|
+
output.receive(sample_record3)
|
199
|
+
output.flush([sample_record1, sample_record2, sample_record3])
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
157
203
|
def start_zookeeper
|
158
204
|
@zk_server = ZK::Server.new do |config|
|
159
205
|
config.client_port = 3292
|