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.

  1. Create a schema.xml file by copying an existing schema.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 new schema.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: />
    The schema.xml file describes the document fields, their types, and how they are indexed.
  2. Create a Solrconfig.xml file by copying one from an existing sensor.
    The Solrconfig.xml file does not vary based on the content of the index.
  3. Ensure that the Solr user has permission to access both the schema.xml and solrconfig.xml files.
  4. Navigate to the $SOLR_USER and add the schema.xml file and the Solrconfig.xml file to the /usr/hcp/$METRON_HOME/config/schema directory.
  5. 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.
  6. Display the Solr UI to view your new collection.
    Refer to Solr Index Schemas for more information.