summaryrefslogtreecommitdiffstats
path: root/extra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh
diff options
context:
space:
mode:
authorosgn422w <gervais-martial.ngueko@intl.att.com>2020-01-30 16:00:05 +0100
committerosgn422w <gervais-martial.ngueko@intl.att.com>2020-01-30 16:56:33 +0100
commit4abf1c966abcecfd42bcaaceeae6d2c197c69df3 (patch)
tree1ef3cd0c531faa9e47ab3373f6a83fc4539096a8 /extra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh
parent96078b6156c74da9c7810f2733d6c50f69711a62 (diff)
Dashboard initial commit
Initial commit of Dashboard based on Open Distro ES-kibana. Issue-ID: CLAMP-483 Change-Id: Ib4a3c686696dd77ba9012424f31389307c8bb720 Signed-off-by: osgn422w <gervais-martial.ngueko@intl.att.com>
Diffstat (limited to 'extra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh')
-rwxr-xr-xextra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/extra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh b/extra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh
new file mode 100755
index 0000000..4929412
--- /dev/null
+++ b/extra/docker/elk/tools/EsAutoQuery/autoQueryLoop.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+QUERY_FILE=${1:-query.json}
+INDEX=${2:-logstash-*}
+HOST_URL=${3:-http://localhost:9200}
+URL=$HOST_URL/$INDEX/_search
+
+function usage() {
+ echo "Usage: $0 [QUERY_FILE [INDEX [HOST_URL]]]"
+ echo
+ echo "This script automatically sends the query file to elasticsearch"
+ echo "each time it's modified."
+}
+
+if [ "${1}" == "--help" ];
+then
+ usage
+ exit 0
+fi
+
+echo "Querying '$URL' with '$QUERY_FILE'"
+while [ 1 ];
+do
+ curl -XGET "$URL" -H 'Content-Type: application/json' -d"@$QUERY_FILE" | js-beautify
+ echo
+ inotifywait -e modify query.json
+done