From d0a06f87e95037fc1242e99f57572bc9a4d15763 Mon Sep 17 00:00:00 2001 From: Cas Donoghue Date: Wed, 9 Apr 2025 13:32:32 -0700 Subject: [PATCH] Ensure elasticsearch logs and data dirs exist before startup (#17531) With a recent change in ES https://github.com/elastic/elasticsearch/pull/125449 configuring path.data or path.logs to directories that do not exist cause ES to not be able to start up. This commit ensures those directories exist. The teardown script already ensures they are removed https://github.com/elastic/logstash/blob/712b37e1df333e8d156cb5d26fbc24aafcbfd2cd/qa/integration/services/elasticsearch_teardown.sh#L26-L27 (cherry picked from commit 8e6e183adc4d325d71a9d047d84845c2c3f5d967) --- qa/integration/services/elasticsearch_setup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qa/integration/services/elasticsearch_setup.sh b/qa/integration/services/elasticsearch_setup.sh index 4811877d451..7acd564da7a 100755 --- a/qa/integration/services/elasticsearch_setup.sh +++ b/qa/integration/services/elasticsearch_setup.sh @@ -5,10 +5,13 @@ current_dir="$(dirname "$0")" source "$current_dir/helpers.sh" ES_HOME="$current_dir/../../../build/elasticsearch" +ES_DATA_PATH="/tmp/ls_integration/es-data" +ES_LOGS_PATH="/tmp/ls_integration/es-logs" start_es() { es_args=$@ - JAVA_HOME= $ES_HOME/bin/elasticsearch -Expack.security.enabled=false -Epath.data=/tmp/ls_integration/es-data -Ediscovery.type=single-node -Epath.logs=/tmp/ls_integration/es-logs $es_args -p $ES_HOME/elasticsearch.pid > /tmp/elasticsearch.log 2>/dev/null & + mkdir -p $ES_DATA_PATH $ES_LOGS_PATH + JAVA_HOME= $ES_HOME/bin/elasticsearch -Expack.security.enabled=false -Epath.data=$ES_DATA_PATH -Ediscovery.type=single-node -Epath.logs=$ES_LOGS_PATH $es_args -p $ES_HOME/elasticsearch.pid > /tmp/elasticsearch.log 2>/dev/null & count=120 echo "Waiting for elasticsearch to respond..." while ! curl --silent localhost:9200 && [[ $count -ne 0 ]]; do