Created
September 25, 2018 08:58
-
-
Save guessi/662297d26bcf23f27a50528471134f11 to your computer and use it in GitHub Desktop.
Dump ElasticSearch Log from Cluster 1 to Cluster 2
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
#!/usr/bin/env bash | |
# simple script for dumping elastic log from one to another | |
ES_SRC_ENDPOINT="192.168.0.100:9200" | |
ES_DST_ENDPOINT="192.168.0.200:9200" | |
ES_INDEX_NAME="logstash-2018.09.25" | |
INPUT="http://${ES_SRC_ENDPOINT}/${ES_INDEX_NAME}" | |
OUTPUT="http://${ES_DST_ENDPOINT}/${ES_INDEX_NAME}" | |
TIME_START="2018-09-25T06:30:00.000Z" | |
TIME_END="2018-09-25T06:45:00.000Z" | |
BATCH_LIMIT=10000 | |
SEARCH_BODY=' | |
{ | |
"query": { | |
"range": { | |
"@timestamp": { | |
"gte": "'${TIME_START}'", | |
"lt": "'${TIME_END}'" | |
} | |
} | |
} | |
}' | |
docker run --rm -it taskrabbit/elasticsearch-dump \ | |
elasticdump --input=${INPUT} --output=${OUTPUT} --limit ${BATCH_LIMIT} \ | |
--searchBody "${SEARCH_BODY}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment