Created
June 23, 2017 00:17
-
-
Save portante/ed1b66a85d40a253a4886e6e0bf589b4 to your computer and use it in GitHub Desktop.
A simple script to calculate the total size of data per day for all indices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ES_URL='https://localhost:9200' | |
| curl_get='curl -s -X GET --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key' | |
| $curl_get $ES_URL/_cat/indices?bytes=m > /tmp/indices.lis | |
| for days_back in {1..7}; do | |
| thedate=$(date --date="-${days_back} day" +"%Y.%m.%d") | |
| echo "$thedate: $(grep $thedate /tmp/indices.lis | awk '{sum += $8} END {print sum}')" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment