通過網址獲取ES最近10分鐘的資料量
阿新 • • 發佈:2020-12-16
技術標籤:Linux & DevOpses
NOWTIME=`date +"%Y-%m-%d %H:%M:%S"` Last10min=`date -d '-10 mins' +"%Y-%m-%d %H:%M:%S"` YearMonth=`date +"%Y%m"` curl -XGET "http://192.168.55.47:9200/index_name_${YearMonth}/_search" -H 'Content-Type: application/json' -s -d' { "size": 0, "query": { "range": { "rcrd_time": { "gte": "'"$Last10min"'", "lte": "'"$NOWTIME"'" } } } }' > t.log sed -i "s/.*\"hits\":{\"total\"://g" t.log sed -i "s/,.*//g" t.log cat t.log