logstash-output-custom-solr 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logstash/outputs/solr.rb +21 -7
- data/logstash-output-custom-solr.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352ec3438631b436ea2432b8146a601e9b5c5f78fe11d36708de700964511ec9
|
4
|
+
data.tar.gz: fdc03fdf4931310b1aea3e563c2779276bd4a8f2716cee108d80f43b93224351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af46d59b27cfaae98dfb781885fd7136df8da44b009030dc8036c90e66cb9dfc31a1c4d06e5e9d099c946ff57a87a5f0c74cdba74ff59797407ffc81c706027
|
7
|
+
data.tar.gz: 042db23fbf4d788c21b57e4fbdff63a38d8847835ced2daa62791edf5eb3a13f4f4c9cfe3323cb4b4cb04353c39e1effed629d99b0fde2145445ec5e293b529d
|
@@ -22,6 +22,9 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
|
|
22
22
|
# The SolrCloud collection name.
|
23
23
|
config :collection, :validate => :string, :default => 'collection1'
|
24
24
|
|
25
|
+
# A field name with the name of collection to send document to
|
26
|
+
config :collection_field, :validate => :string, :default => nil
|
27
|
+
|
25
28
|
# Commit every batch?
|
26
29
|
config :commit, :validate => :boolean, :default => false
|
27
30
|
|
@@ -77,7 +80,7 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
|
|
77
80
|
|
78
81
|
public
|
79
82
|
def flush(events, close=false)
|
80
|
-
|
83
|
+
documents_per_col = {}
|
81
84
|
|
82
85
|
events.each do |event|
|
83
86
|
document = event.to_hash()
|
@@ -92,7 +95,15 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
|
|
92
95
|
|
93
96
|
@logger.info 'Record: %s' % document.inspect
|
94
97
|
|
98
|
+
if !@collection_field and document.has_key?(@collection_field) then
|
99
|
+
collection = document[@collection_field]
|
100
|
+
else
|
101
|
+
collection = @collection
|
102
|
+
end
|
103
|
+
|
104
|
+
documents = documents_per_col.fetch(collection, [])
|
95
105
|
documents.push(document)
|
106
|
+
documents_per_col[collection] = documents
|
96
107
|
end
|
97
108
|
|
98
109
|
params = {}
|
@@ -100,12 +111,15 @@ class LogStash::Outputs::Solr < LogStash::Outputs::Base
|
|
100
111
|
params[:commit] = true
|
101
112
|
end
|
102
113
|
params[:commitWithin] = @commitWithin
|
103
|
-
|
104
|
-
|
105
|
-
@
|
106
|
-
|
107
|
-
|
108
|
-
@
|
114
|
+
|
115
|
+
hash.each do |collection, documents|
|
116
|
+
if @mode == MODE_STANDALONE then
|
117
|
+
@solr.add documents, :params => params
|
118
|
+
@logger.info 'Added %d document(s) to Solr' % documents.count
|
119
|
+
elsif @mode == MODE_SOLRCLOUD then
|
120
|
+
@solr.add documents, collection: @collection, :params => params
|
121
|
+
@logger.info 'Added %d document(s) to "%s" collection' % documents.count, collection
|
122
|
+
end
|
109
123
|
end
|
110
124
|
|
111
125
|
rescue Exception => e
|
@@ -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.8"
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-custom-solr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minoru Osuka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|