tpotce/installer/bin/dump_elk.sh
2017-03-17 23:47:04 +00:00

21 lines
665 B
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#/bin/bash
myDATE=$(date +%Y%m%d%H%M)
myINDICES=$(curl -s -XGET 'http://127.0.0.1:64298/_cat/indices/' | grep logstash | awk '{ print $3 }' | sort | grep -v 1970)
myES="http://127.0.0.1:64298/"
myCOL1=""
myCOL0=""
mkdir $myDATE
for i in $myINDICES;
do
echo $myCOL1"### Now dumping: "$i $myCOL0
elasticdump --input=$myES$i --output=$myDATE"/"$i --limit 7500
echo $myCOL1"### Now compressing: $myDATE/$i" $myCOL0
gzip -f $myDATE"/"$i
done;
echo $myCOL1"### Now building tar archive: es_dump_"$myDATE".tgz" $myCOL0
cd $myDATE
tar cvfz es_dump_$myDATE.tgz *
mv es_dump_$myDATE.tgz ..
cd ..
rm -rf $myDATE
echo $myCOL1"### Done."$myCOL0