Update Elasticsearch Templates to Work with Elasticsearch 5.6.x
HCP requires that all sensor templates have a nested metron_alert
field defined to work with Elasticsearch 5.6.x.
HCP requires that all sensor templates have a nested metron_alert
field defined to work with Elasticsearch 5.6.x.
index*
to get all indexes for the
provided sensor:export ELASTICSEARCH="node1"
export SENSOR="bro"
curl -XGET "http://${ELASTICSEARCH}:9200/_template/${SENSOR}_index*?pretty=true" -o "${SENSOR}.template"
sed -i '' '2d;$d' ./${SENSOR}.template
sed -i '' '/"properties" : {/ a\
"metron_alert": { "type": "nested"},' ${SENSOR}.template
python -m json.tool bro.template
curl -XPUT "http://${ELASTICSEARCH}:9200/_template/${SENSOR}_index" -d @${SENSOR}.template
curl -XPUT "http://${ELASTICSEARCH}:9200/${SENSOR}_index*/_mapping/${SENSOR}_doc" -d '
{
"properties" : {
"metron_alert" : {
"type" : "nested"
}
}
}
'
rm ${SENSOR}.template