Skip to content

Commit

Permalink
[opensearch-logs] fix typo in dashboard pattern script
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuckkuck committed Dec 20, 2024
1 parent f6851df commit 3462217
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash
export BASIC_AUTH_HEADER=${ADMIN_USER}:${ADMIN_PASSWORD}



# Creating aliases for all indexes, because logstash-* is also selecting datastreams besides the logstash-2024... indexes.
for i in $(curl -s -u ${BASIC_AUTH_HEADER} "${CLUSTER_HOST}/_cat/indices?v"|awk '{ print $3 }'|awk -F- '{ print $1 }'|sort|uniq|grep -v "\."|grep -v "index")
do
Expand All @@ -14,7 +12,7 @@ for i in $(curl -s -u ${BASIC_AUTH_HEADER} "${CLUSTER_HOST}/_cat/indices?v"|awk
echo "Alias and dashboard index pattern for index ${i} already exists. Nothing to do."
else
echo "setting OpenSearch dashboard index mapping for index $i"
curl -s -XPOST --header "content-type: application/JSON" -u ${BASIC_AUTH_HEADER}"${CLUSTER_HOST}/_aliases" -H "osd-xsrf: true" -d "{ \"actions\": [ { \"add\": { \"index\": \"${i}-2*\", \"alias\": \"${i}\" } } ] }"
curl -s -XPOST --header "content-type: application/JSON" -u ${BASIC_AUTH_HEADER} "${CLUSTER_HOST}/_aliases" -H "osd-xsrf: true" -d "{ \"actions\": [ { \"add\": { \"index\": \"${i}-2*\", \"alias\": \"${i}\" } } ] }"
fi
echo "Deleting old index pattern based on index-* format"
export DASHBOARD_PATTERN=`curl -s --header "content-type: application/JSON" --fail -XGET -u ${BASIC_AUTH_HEADER} "${DASHBOARD_HOST}/api/saved_objects/index-pattern/${i}-*"|grep "content-length"|awk -F: '{ print $2 }'|tr -d '[:space:]'`
Expand Down

0 comments on commit 3462217

Please sign in to comment.