mantis-logstash-output-solr_http 3.0.5.m3 → 3.0.5.pre.m2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31ae755af8c4947a8bb6f234dac3c57865dce351393319cf3353bf7cad8b9011
4
- data.tar.gz: ce321756d1a30fc09c128b54246c9e3d05ddd0f16a321547712a46d18d5344b8
3
+ metadata.gz: 535a98a817473be4ce4f70de9e28bf8f1442c1babf1832098e25305c1c0ecd02
4
+ data.tar.gz: d1b4813f0d037253bb27ef5fcfe817798aaeddfe6b26adac53c3d6d9225b5b73
5
5
  SHA512:
6
- metadata.gz: 3fb2933a964428a4a168a7ca20a4dabbe7df8aae5e2db949f988e38816c90beb19ca03fc837e7e4bc1df6761e160c37601044962fd8ec09d9136ada998cb74f1
7
- data.tar.gz: 6ae3457dfd46427449f0e057218b825ff8c41500b15aabfe2b97ce07e1218e16a54e125d26408e4e3c0c3f83b4ff0f24283391323fa5046201138279957ff522
6
+ metadata.gz: 780015cc7c410a2b62164f1ff1714b4edaf8d52be0ed28524780d1f7694ade38aaf5c0b0f6afa3e538f895cdefd3f56cdd6447dc7ad795b6eae7705d63458a9f
7
+ data.tar.gz: 6049ddbb2010d465f3d31f1220858075a7b16cc9cb5aef6eff855c329bcd4bc61503c7441415eec2eb89f8c78252172ba3247c9e4538edda921aa7df4decbd61
@@ -42,6 +42,7 @@ class LogStash::Outputs::SolrHTTP < LogStash::Outputs::Base
42
42
  public
43
43
  def register
44
44
  require "rsolr"
45
+ @solr = RSolr.connect :url => @solr_url
45
46
  buffer_initialize(
46
47
  :max_items => @flush_size,
47
48
  :max_interval => @idle_flush_time,
@@ -55,16 +56,20 @@ class LogStash::Outputs::SolrHTTP < LogStash::Outputs::Base
55
56
  buffer_receive(event)
56
57
  end #def receive
57
58
 
59
+ public
58
60
  public
59
61
  def flush(events, close=false)
60
62
  documents = Hash.new #this is the array of hashes that we push to Solr as documents
61
63
 
62
64
  events.each do |event|
63
65
  url = event.sprintf(@solr_url)
66
+
64
67
  if documents[url].nil?
65
68
  documents[url]=[]
66
69
  end
70
+
67
71
  document = event.to_hash()
72
+
68
73
  if @document_id.nil?
69
74
  document ["id"] = UUIDTools::UUID.random_create #add a unique ID
70
75
  else
@@ -72,11 +77,13 @@ class LogStash::Outputs::SolrHTTP < LogStash::Outputs::Base
72
77
  end
73
78
  documents[url].push(document)
74
79
  end
80
+
75
81
  documents.keys.each do |url|
76
82
  solr = RSolr.connect :url => url
77
83
  solr.add(documents[url])
78
84
  end
85
+
79
86
  rescue Exception => e
80
87
  @logger.warn("An error occurred while indexing: #{e.message}")
81
88
  end #def flush
82
- end #class LogStash::Outputs::SolrHTTP
89
+ end #class LogStash::Outputs::SolrHTTP
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'mantis-logstash-output-solr_http'
4
- s.version = '3.0.5.m3'
4
+ s.version = '3.0.5-m2'
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"
metadata CHANGED
@@ -1,14 +1,14 @@
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.m3
4
+ version: 3.0.5.pre.m2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-09 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +102,6 @@ files:
102
102
  - README.md
103
103
  - docs/index.asciidoc
104
104
  - lib/logstash/outputs/solr_http.rb
105
- - lib/logstash/outputs/test.rb
106
105
  - logstash-output-solr_http.gemspec
107
106
  - spec/outputs/solr_http_spec.rb
108
107
  homepage: https://github.com/mantis-software-company/logstash-output-solr_http
@@ -1,23 +0,0 @@
1
- events=[{id:22}]
2
- @solr_url="a"
3
- documents = Hash.new #this is the array of hashes that we push to Solr as documents
4
-
5
- events.each do |event|
6
- url = @solr_url
7
- if documents[url].nil?
8
- documents[url]=[]
9
- end
10
- document = event.to_hash()
11
- if @document_id.nil?
12
- document ["id"] = "UUIDTools::UUID.random_create" #add a unique ID
13
- else
14
- document ["id"] = @document_id #or use the one provided
15
- end
16
- documents[url].push(document)
17
- end
18
-
19
- documents.keys.each do |url|
20
- #solr = RSolr.connect :url => url
21
- #solr.add(documents[url])
22
- puts documents[url]
23
- end