From 6c562a3b168c6964bbb9a0af1f6c07a145fd9aa8 Mon Sep 17 00:00:00 2001 From: Maximilian Moser <maximilian.moser@tuwien.ac.at> Date: Mon, 15 Jan 2024 18:24:24 +0100 Subject: [PATCH] Validate the OpenSearch connection with a preflight request * this is useful to see if the authentication and everything else works --- reporting/opensearch.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reporting/opensearch.sh b/reporting/opensearch.sh index c8a9136..1bc70f0 100755 --- a/reporting/opensearch.sh +++ b/reporting/opensearch.sh @@ -32,6 +32,9 @@ host="${OPENSEARCH_URL:-https://s63.dl.hpc.tuwien.ac.at:9200}" index_pattern="${OPENSEARCH_INDEX_PATTERN:-logstash-tudata-main-*}" log_name="${OPENSEARCH_LOG_NAME:-nginx.main}" +# test the waters, to see if the requests work (especially regarding authentication) +curl -s -f -u "${username}:${password}" "${host}/_cat" > /dev/null + # as long as there's still hits, keep querying... while [[ "${continue}" -gt 0 ]]; do # update the query to incorporate the latest 'sort' value (will be 0 the first time around) -- GitLab