VIEW=$(curl -s http://localhost:5080/api/v1/saved_views/$VIEW_ID \
-H "authorization: Bearer $MS_JWT")
END=$(date +%s)000000
START=$((END - $(echo "$VIEW" | jq .time_range_secs) * 1000000))
curl -X POST http://localhost:5080/api/v1/query \
-H "authorization: Bearer $MS_JWT" \
-H 'content-type: application/json' \
-d "{\"org_id\":\"$MS_ORG\",
\"language\":$(echo "$VIEW" | jq .language),
\"statement\":$(echo "$VIEW" | jq .statement),
\"time_range\":{\"start\":$START,\"end\":$END},
\"stream\":{\"name\":$(echo "$VIEW" | jq .stream),\"stream_type\":\"logs\"}}"