mantis-logstash-output-solr_http 3.0.5.pre.m3 → 3.0.5.pre.m8
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_http.rb +18 -16
- data/logstash-output-solr_http.gemspec +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79d7f05566f4d7f60b61abdcf1cf553ae42dab506fa9964c49f43598c1e4e965
|
4
|
+
data.tar.gz: a24c9211fc9e53aead695fb99493ef55ead1110e4862c94782005ba3d3bc303b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce0f63ac7e8a2907c0a3decd39ccfa734eab30939f91036320fe51fed29031b806c5404d7592a46ddc5df8ae68950c6c62b77e3d9d0ff02150a12cc6ba17ea04
|
7
|
+
data.tar.gz: 136a7898e65489aecfb61bfa27307123379867263eec42008b6b51672f99c3e43828d30a77c0e3c588bb46e629b0ee6ef1ff4e5064b479e48a1d3b812a9f26bd
|
@@ -39,10 +39,12 @@ class LogStash::Outputs::SolrHTTP < LogStash::Outputs::Base
|
|
39
39
|
# '%{foo}' so you can assign your own IDs
|
40
40
|
config :document_id, :validate => :string, :default => nil
|
41
41
|
|
42
|
+
# Solr field name of document ID field name.
|
43
|
+
config :document_id_field, :validate => :string, :default => "id"
|
44
|
+
|
42
45
|
public
|
43
46
|
def register
|
44
47
|
require "rsolr"
|
45
|
-
@solr = RSolr.connect :url => @solr_url
|
46
48
|
buffer_initialize(
|
47
49
|
:max_items => @flush_size,
|
48
50
|
:max_interval => @idle_flush_time,
|
@@ -52,38 +54,38 @@ class LogStash::Outputs::SolrHTTP < LogStash::Outputs::Base
|
|
52
54
|
|
53
55
|
public
|
54
56
|
def receive(event)
|
55
|
-
|
56
57
|
buffer_receive(event)
|
57
58
|
end #def receive
|
58
59
|
|
59
|
-
public
|
60
60
|
public
|
61
61
|
def flush(events, close=false)
|
62
|
-
documents = Hash.new
|
63
|
-
|
62
|
+
documents = Hash.new #this is the map of hashes that we push to Solr as documents
|
64
63
|
events.each do |event|
|
65
|
-
url = event.sprintf(@solr_url)
|
64
|
+
url = event.sprintf(@solr_url) # solr url sprintf
|
66
65
|
|
67
|
-
if documents[url].nil?
|
68
|
-
documents[url]=[]
|
69
|
-
|
70
|
-
|
71
|
-
document = event.to_hash()
|
72
|
-
|
66
|
+
if documents[url].nil?
|
67
|
+
documents[url]=[] # create a new array to url
|
68
|
+
@logger.debug("new url created [#{url}]")
|
69
|
+
end
|
70
|
+
document = event.to_hash()
|
73
71
|
if @document_id.nil?
|
74
|
-
document [
|
72
|
+
document [@document_id_field] = UUIDTools::UUID.random_create #add a unique ID
|
75
73
|
else
|
76
|
-
document [
|
74
|
+
document [@document_id_field] = event.sprintf(@document_id) #or use the one provided
|
77
75
|
end
|
78
76
|
documents[url].push(document)
|
79
77
|
end
|
80
|
-
|
78
|
+
@logger.debug("#{documents.keys.length()} url detected")
|
81
79
|
documents.keys.each do |url|
|
82
80
|
solr = RSolr.connect :url => url
|
81
|
+
@logger.debug("solr connected [#{url}]")
|
82
|
+
@logger.debug("#{documents[url].length()} documents indexing...")
|
83
83
|
solr.add(documents[url])
|
84
|
+
@logger.debug("#{documents[url].length()} documents indexed.")
|
85
|
+
solr.commit :commit_attributes => {}
|
84
86
|
end
|
85
87
|
|
86
88
|
rescue Exception => e
|
87
89
|
@logger.warn("An error occurred while indexing: #{e.message}")
|
88
90
|
end #def flush
|
89
|
-
end #class LogStash::Outputs::SolrHTTP
|
91
|
+
end #class LogStash::Outputs::SolrHTTP
|
@@ -1,13 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'mantis-logstash-output-solr_http'
|
4
|
-
s.version = '3.0.5-
|
4
|
+
s.version = '3.0.5-m8'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Stores and indexes logs in Solr"
|
7
7
|
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 gemname. This gem is not a stand-alone program"
|
8
8
|
s.authors = ["Elastic"]
|
9
|
-
s.email = 'info@
|
10
|
-
s.homepage = "
|
9
|
+
s.email = 'info@elastic.co'
|
10
|
+
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mantis-logstash-output-solr_http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.5.pre.
|
4
|
+
version: 3.0.5.pre.m8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
@@ -89,7 +89,7 @@ dependencies:
|
|
89
89
|
description: This gem is a Logstash plugin required to be installed on top of the
|
90
90
|
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
91
91
|
gem is not a stand-alone program
|
92
|
-
email: info@
|
92
|
+
email: info@elastic.co
|
93
93
|
executables: []
|
94
94
|
extensions: []
|
95
95
|
extra_rdoc_files: []
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- lib/logstash/outputs/solr_http.rb
|
105
105
|
- logstash-output-solr_http.gemspec
|
106
106
|
- spec/outputs/solr_http_spec.rb
|
107
|
-
homepage:
|
107
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
108
108
|
licenses:
|
109
109
|
- Apache License (2.0)
|
110
110
|
metadata:
|