#!/bin/bash # # Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one # or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at # https://securityonion.net/license; you may not use this file except in compliance with the # Elastic License 2.0. . /usr/sbin/so-common SKIP=0 ######################################### # Options ######################################### usage() { cat < /dev/null 2>&1 done fi # Delete Elastalert data if [ ! -z "$DELETE_ELASTALERT_DATA" ]; then # Delete Elastalert data echo "Deleting Elastalert data..." INDXS=$(/usr/sbin/so-elasticsearch-query _cat/indices?h=index | grep "elastalert") for INDX in ${INDXS} do echo "Deleting $INDX" /usr/sbin/so-elasticsearch-query ${INDX} -XDELETE > /dev/null 2>&1 done fi # Delete log data if [ ! -z "$DELETE_LOG_DATA" ]; then echo "Deleting log data ..." DATASTREAMS=$(/usr/sbin/so-elasticsearch-query _data_stream | jq -r '.[] |.[].name') for DATASTREAM in ${DATASTREAMS} do # Delete the data stream echo "Deleting $DATASTREAM..." /usr/sbin/so-elasticsearch-query _data_stream/${DATASTREAM} -XDELETE > /dev/null 2>&1 done fi if [ -z "$DONT_STOP_SERVICES" ]; then #Start Logstash if [ ! -z "$LS_ENABLED" ]; then /usr/sbin/so-logstash-start fi #Start Elastic Fleet #if [ ! -z "$EF_ENABLED" ]; then # /usr/sbin/so-elastic-fleet-start #fi #Start Elastalert if [ ! -z "$EA_ENABLED" ]; then /usr/sbin/so-elastalert-start fi # Start Elastic Agent /usr/sbin/so-elastic-agent-restart fi