mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-09 10:42:54 +01:00
check for index existence before attemping rollover
Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com>
This commit is contained in:
@@ -814,12 +814,16 @@ rollover_index() {
|
|||||||
idx=$1
|
idx=$1
|
||||||
exists=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx")
|
exists=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx")
|
||||||
|
|
||||||
rollover=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx/_rollover" -XPOST)
|
if [[ $exists -eq 200 ]]; then
|
||||||
|
rollover=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx/_rollover" -XPOST)
|
||||||
|
|
||||||
if [[ $rollover -eq 200 ]]; then
|
if [[ $rollover -eq 200 ]]; then
|
||||||
echo "Successfully triggered rollover for $idx..."
|
echo "Successfully triggered rollover for $idx..."
|
||||||
|
else
|
||||||
|
echo "Could not trigger rollover for $idx..."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Could not trigger rollover for $idx..."
|
echo "Could not find index $idx..."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user