From 08220e3330e00bbce0b286a8f3851d0cbd600297 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 | 30 +++++++++++++++++++++---- test.test | 0 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 test.test diff --git a/salt/common/tools/sbin/so-elastic-clear b/salt/common/tools/sbin/so-elastic-clear index 84ebcaf78..8e0ca877a 100755 --- a/salt/common/tools/sbin/so-elastic-clear +++ b/salt/common/tools/sbin/so-elastic-clear @@ -14,6 +14,8 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see .. /usr/sbin/so-common +{%- set MASTERIP = salt['pillar.get']('static:masterip', '') -%} +. /usr/sbin/so-common SKIP=0 ######################################### @@ -64,13 +66,24 @@ fi # 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 -elif [ ! -z "$LS_ENABLED" ]; then +fi + +if [ ! -z "$LS_ENABLED" ]; then /usr/sbin/so-logstash-stop + +fi + +if [ ! -z "$EA_ENABLED" ]; then + + /usr/sbin/so-elastalert-stop + fi # Delete data @@ -87,8 +100,17 @@ if [ ! -z "$FB_ENABLED" ]; then /usr/sbin/so-filebeat-start -elif [ ! -z "$LS_ENABLED" ]; then - - /usr/sbin/so-logstash-start +fi + +if [ ! -z "$LS_ENABLED" ]; then + + /usr/sbin/so-logstash-start + +fi + +if [ ! -z "$EA_ENABLED" ]; then + + /usr/sbin/so-elastalert-start + fi diff --git a/test.test b/test.test new file mode 100644 index 000000000..e69de29bb