Skip to content

Instantly share code, notes, and snippets.

@saswata-dutta
Last active October 17, 2019 14:58
Show Gist options
  • Save saswata-dutta/b676953d75e21f9484c9f3b429182a3c to your computer and use it in GitHub Desktop.
Save saswata-dutta/b676953d75e21f9484c9f3b429182a3c to your computer and use it in GitHub Desktop.
cli call and parse elk logs
#!/usr/bin/env bash
index="$1"
pattern="$2"
size="$3"
query="http://ek-elasticsearch.rivigo.com/${index}/_doc/_search?q=stackTrace:${pattern}&_source=stackTrace&scroll=10m&size=${size}&filter_path=hits.hits._source.stackTrace"
curl -s -XGET "${query}" | jq ".hits.hits[]._source.stackTrace" -r
# curl -X POST \
# 'http://ek-elasticsearch.rivigo.com/rivigo-eta-2019.10.14/_doc/_search?scroll=1m&filter_path=hits.hits._source.stackTrace&pretty' \
# -H 'Content-Type: application/json' \
# -d '{
# "size": 10,
# "_source": ["stackTrace"],
# "query": {
# "match": {
# "stackTrace": "Vehicle deviated from point by"
# }
# }
# }'
# curl -X POST \
# http://ek-elasticsearch.rivigo.com/_search/scroll \
# -H 'Content-Type: application/json' \
# -d '{
# "scroll" : "1m",
# "scroll_id" : "DnF1ZXJ5VGhlbkZldGNoAgAAAAAAAAFFFnN2N3VvX1dTUnVPR2lMSnZ2M2xEN0EAAAAAAAACMhZfOWdnX1ZNS1IzZU1XNjA4eXVGMXl3"
# }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment