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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b85a86b86108b4321e31f21d99ef2e47350fcc8a8a3e15ca5612358701529bc
4
- data.tar.gz: f43d6e3750760969bbcf1cc321369165d832e67a33b1e536b75f85c816e306d5
3
+ metadata.gz: 79d7f05566f4d7f60b61abdcf1cf553ae42dab506fa9964c49f43598c1e4e965
4
+ data.tar.gz: a24c9211fc9e53aead695fb99493ef55ead1110e4862c94782005ba3d3bc303b
5
5
  SHA512:
6
- metadata.gz: e7d303be5abce64a9978b090e0a9a9422e201b7ed85d5df0d86ea1cadc0476014615d18d6c3d00a5a0b621b889c0c2c2be20b034165d1775191f6d0d83d7775a
7
- data.tar.gz: fc8ed8cb6ad5a2c02ae491f56fe07c183acf9cfe366691a1cc0371cbfc6fe1252fa7a45ecc80c5e67f48985e7eef83135cd2254c0d42f2f76d863654b06ad8df
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 #this is the array of hashes that we push to Solr as documents
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
- end
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 ["id"] = UUIDTools::UUID.random_create #add a unique ID
72
+ document [@document_id_field] = UUIDTools::UUID.random_create #add a unique ID
75
73
  else
76
- document ["id"] = event.sprintf(@document_id) #or use the one provided
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-m3'
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@mantis.com.tr'
10
- s.homepage = "https://github.com/mantis-software-company/logstash-output-solr_http"
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.m3
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@mantis.com.tr
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: https://github.com/mantis-software-company/logstash-output-solr_http
107
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
108
108
  licenses:
109
109
  - Apache License (2.0)
110
110
  metadata: