Skip to content

Commit

Permalink
Merge pull request #337 from jcantrill/add_es_util
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Feb 24, 2017
2 parents 0bdc7e5 + 7acb01d commit 0f79b25
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions elasticsearch/Dockerfile
Expand Up @@ -40,6 +40,7 @@ ADD index_templates/ /usr/share/elasticsearch/index_templates/
ADD install.sh ${HOME}/
RUN ${HOME}/install.sh
ADD run.sh ${HOME}/
ADD es_util /usr/local/bin

WORKDIR ${HOME}
USER 1000
Expand Down
17 changes: 17 additions & 0 deletions elasticsearch/es_util
@@ -0,0 +1,17 @@
#/bin/bash -euxo pipefail

# Utility to grab documents from the ES
# instance using the admin certs and keys

QUERY=${QUERY:-""}
INDEX=${INDEX:-"project.*"}
SIZE=${SIZE:-10}
SORT=${SORT:-"@timestamp:desc"}

BASE=${BASE:-https://localhost:9200}

if [ -z "${QUERY:-}" ]; then
QUERY="$BASE/$INDEX/_search?size=$SIZE&sort=$SORT"
fi

curl -s -k --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key $QUERY | python -mjson.tool

0 comments on commit 0f79b25

Please sign in to comment.