Create a New Solr Index Collection
When you set up a new sensor, you must create either a new index template if you are using Elasticsearch or a new index schema if you are using Solr.
-
Create a
schema.xml
file by copying an existingschema.xml
file from another sensor and then replace the existing fields with the fields supported by your new sensor.You can leave the common fields and type definitions in the newschema.xml
file.For example:tail -n10 /usr/$METRON_HOME/config/schema/$SENSOR_DIRECTORY/schema.xml <field name="ip_src_addr" type ="ip" indexed="true" stored="true: /> <field name="ip_src_port" type ="pint" indexed="true" stored="true: /> <field name="ip_src_addr" type ="ip" indexed="true" stored="true: /> <field name="ip_dst_port" type ="pint" indexed="true" stored="true: />
Theschema.xml
file describes the document fields, their types, and how they are indexed. -
Create a
Solrconfig.xml
file by copying one from an existing sensor.TheSolrconfig.xml
file does not vary based on the content of the index. -
Ensure that the Solr user has permission to access both the
schema.xml
andsolrconfig.xml
files. -
Navigate to the $SOLR_USER and add the
schema.xml
file and theSolrconfig.xml
file to the/usr/hcp/$METRON_HOME/config/schema
directory. -
As the $SOLR_USER, use
create_collection.sh
to create the collection for your new sensor:export SOLR_HOME='opt/lucidworks-hdpsearch/solr/ export SOLR_USER=solr export METRON_HOME=/usr/hcp/current/metron export ZOOKEEPER=localhost:2181/solr sudo -E su $SOLR_USER -c $METRON_HOME/bin/create_collection.sh $1 ./create_solr_collection.sh $SENSOR_NAME
You can ignore the error logs. -
Display the Solr UI to view your new collection.
Refer to Solr Index Schemas for more information.