diff --git a/logstash_deploy/logstash/outputs/lucidworks_solr_lsv122.rb b/logstash_deploy/logstash/outputs/lucidworks_solr_lsv122.rb index 7587ccc..dd098a8 100644 --- a/logstash_deploy/logstash/outputs/lucidworks_solr_lsv122.rb +++ b/logstash_deploy/logstash/outputs/lucidworks_solr_lsv122.rb @@ -36,6 +36,9 @@ class LogStash::Outputs::LucidWorks < LogStash::Outputs::Base # Prefix will replace the @ in logstash fieldnames @timestash and @version. config :field_prefix, :validate => :string, :default => "logstash_" + # Webapp name + config :webapp_name, :validate => :string, :default => "solr" + @lucidworks @solrFieldCreationParams @@ -73,7 +76,7 @@ def register @solrFieldCreationParams = java.util.HashMap.new(@solrFieldCreationParams) - @lucidworks.init(@collection_host, @collection_port, @collection_name) + @lucidworks.init(@collection_host, @collection_port, @collection_name, false, @webapp_name) end # def register public diff --git a/logstash_deploy/logstash/outputs/lucidworks_solr_lsv133.rb b/logstash_deploy/logstash/outputs/lucidworks_solr_lsv133.rb index 61dcf70..8091a8b 100644 --- a/logstash_deploy/logstash/outputs/lucidworks_solr_lsv133.rb +++ b/logstash_deploy/logstash/outputs/lucidworks_solr_lsv133.rb @@ -33,6 +33,9 @@ class LogStash::Outputs::LucidWorks < LogStash::Outputs::Base # Prefix will replace the @ in logstash fieldnames @timestash and @version. config :field_prefix, :validate => :string, :default => "logstash_" + # Webapp name + config :webapp_name, :validate => :string, :default => "solr" + # Solr solrconfig.xml can be configured to automatically commit documents after a # specified amount of time or after receipt of a maximum number of documents. For convenience # allow the logger to override this setting for use in cases where the site either isn't @@ -62,7 +65,7 @@ def register # have Solr create them. # - @lucidworks.init(@collection_host, @collection_port, @collection_name, @force_commit) + @lucidworks.init(@collection_host, @collection_port, @collection_name, @force_commit, @webapp_name) @lucidworks.createSchemaField(@field_prefix + "timestamp", "\"type\":\"tdate\",\"name\":\"" + @field_prefix + "timestamp" + "\",\"stored\":true,\"indexed\":true") @lucidworks.createSchemaField(@field_prefix + "version", "\"type\":\"long\",\"name\":\"" + @field_prefix + "version" + "\",\"stored\":true,\"indexed\":true") diff --git a/src/LWSolrLogCollectionManager.java b/src/LWSolrLogCollectionManager.java index a2ccbb6..a9116e0 100644 --- a/src/LWSolrLogCollectionManager.java +++ b/src/LWSolrLogCollectionManager.java @@ -42,7 +42,7 @@ private enum SOLR_RSP { public int getValue() { return id; } } - public void init(String host, int pt, String collection, boolean forceCommit) { + public void init(String host, int pt, String collection, boolean forceCommit, String webappName) { String port = String.valueOf(pt); String update = "/update"; @@ -52,8 +52,8 @@ public void init(String host, int pt, String collection, boolean forceCommit) { // Note the Solr documentation examples do not include the collection. But if // if collection is left out then new records are not added to the index because // the fields are not found even though they do somehow appear in the managed-schema file. - fieldsPath = "http://" + host + ":" + port + "/solr/" + collection + "/schema/fields"; - addNewDocPath = "http://" + host + ":" + port + "/solr/" + collection + update; + fieldsPath = "http://" + host + ":" + port + "/" + webappName + "/" + collection + "/schema/fields"; + addNewDocPath = "http://" + host + ":" + port + "/" + webappName + "/" + collection + update; } /**