From 9ff3ffc401cdc8cd731e1f71e848c02ee0a66358 Mon Sep 17 00:00:00 2001 From: bryant-treacle Date: Wed, 24 Jun 2020 18:40:11 +0000 Subject: [PATCH] Issue #885: so-elastic-clear not removing so-* indices --- salt/common/tools/sbin/so-elastic-clear | 50 +++++++++++++++++++++++++ test.test | 0 2 files changed, 50 insertions(+) create mode 100644 test.test diff --git a/salt/common/tools/sbin/so-elastic-clear b/salt/common/tools/sbin/so-elastic-clear index 2db400839..b491c0453 100755 --- a/salt/common/tools/sbin/so-elastic-clear +++ b/salt/common/tools/sbin/so-elastic-clear @@ -13,7 +13,11 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License +<<<<<<< HEAD # along with this program. If not, see . +======= +# along with this program. If not, see .. /usr/sbin/so-common +>>>>>>> 08220e33... Issue #885: so-elastic-clear not removing so-* indices {%- set MASTERIP = salt['pillar.get']('static:masterip', '') -%} . /usr/sbin/so-common @@ -63,8 +67,33 @@ if [ $SKIP -ne 1 ]; then if [ "$INPUT" != "AGREE" ] ; then exit 0; fi fi +<<<<<<< HEAD /usr/sbin/so-filebeat-stop /usr/sbin/so-logstash-stop +======= +# Check to see if Logstash/Filebeat are running +LS_ENABLED=$(so-status | grep logstash) +FB_ENABLED=$(so-status | grep filebeat) +EA_ENABLED=$(so-status | grep elastalert) + +if [ ! -z "$FB_ENABLED" ]; then + + /usr/sbin/so-filebeat-stop + +fi + +if [ ! -z "$LS_ENABLED" ]; then + + /usr/sbin/so-logstash-stop + +fi + +if [ ! -z "$EA_ENABLED" ]; then + + /usr/sbin/so-elastalert-stop + +fi +>>>>>>> 08220e33... Issue #885: so-elastic-clear not removing so-* indices # Delete data echo "Deleting data..." @@ -75,6 +104,27 @@ do curl -XDELETE "{{ MASTERIP }}:9200/${INDX}" > /dev/null 2>&1 done +<<<<<<< HEAD /usr/sbin/so-logstash-start /usr/sbin/so-filebeat-start +======= +#Start Logstash/Filebeat +if [ ! -z "$FB_ENABLED" ]; then + + /usr/sbin/so-filebeat-start + +fi + +if [ ! -z "$LS_ENABLED" ]; then + + /usr/sbin/so-logstash-start + +fi + +if [ ! -z "$EA_ENABLED" ]; then + + /usr/sbin/so-elastalert-start + +fi +>>>>>>> 08220e33... Issue #885: so-elastic-clear not removing so-* indices diff --git a/test.test b/test.test new file mode 100644 index 000000000..e69de29bb