From efd5f4c54cd7b6305ca1edc291cbfd10d620fe67 Mon Sep 17 00:00:00 2001 From: t3chn0m4g3 Date: Wed, 3 May 2023 22:01:36 +0000 Subject: [PATCH] fixes #1320 --- docker/elk/logstash/dist/entrypoint.sh | 54 +++++++++++++------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/docker/elk/logstash/dist/entrypoint.sh b/docker/elk/logstash/dist/entrypoint.sh index 2e92f100..24736cbd 100644 --- a/docker/elk/logstash/dist/entrypoint.sh +++ b/docker/elk/logstash/dist/entrypoint.sh @@ -57,39 +57,41 @@ if [ "$MY_TPOT_TYPE" == "SENSOR" ]; chmod 600 $MY_SENSOR_PRIVATEKEYFILE cp /usr/share/logstash/config/pipelines_sensor.yml /usr/share/logstash/config/pipelines.yml autossh -f -M 0 -4 -l $MY_HIVE_USERNAME -i $MY_SENSOR_PRIVATEKEYFILE -p 64295 -N -L64305:127.0.0.1:64305 $MY_HIVE_IP -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" - exit 0 fi -# Index Management is happening through ILM, but we need to put T-Pot ILM setting on ES. -myTPOTILM=$(curl -s -XGET "http://elasticsearch:9200/_ilm/policy/tpot" | grep "Lifecycle policy not found: tpot" -c) -if [ "$myTPOTILM" == "1" ]; +if [ "$MY_TPOT_TYPE" != "SENSOR" ]; then - echo "T-Pot ILM template not found on ES, putting it on ES now." - curl -XPUT "http://elasticsearch:9200/_ilm/policy/tpot" -H 'Content-Type: application/json' -d' - { - "policy": { - "phases": { - "hot": { - "min_age": "0ms", - "actions": {} - }, - "delete": { - "min_age": "30d", - "actions": { + # Index Management is happening through ILM, but we need to put T-Pot ILM setting on ES. + myTPOTILM=$(curl -s -XGET "http://elasticsearch:9200/_ilm/policy/tpot" | grep "Lifecycle policy not found: tpot" -c) + if [ "$myTPOTILM" == "1" ]; + then + echo "T-Pot ILM template not found on ES, putting it on ES now." + curl -XPUT "http://elasticsearch:9200/_ilm/policy/tpot" -H 'Content-Type: application/json' -d' + { + "policy": { + "phases": { + "hot": { + "min_age": "0ms", + "actions": {} + }, "delete": { - "delete_searchable_snapshot": true + "min_age": "30d", + "actions": { + "delete": { + "delete_searchable_snapshot": true + } + } } + }, + "_meta": { + "managed": true, + "description": "T-Pot ILM policy with a retention of 30 days" } } - }, - "_meta": { - "managed": true, - "description": "T-Pot ILM policy with a retention of 30 days" - } - } - }' - else - echo "T-Pot ILM already configured or ES not available." + }' + else + echo "T-Pot ILM already configured or ES not available." + fi fi echo