I am trying to run a for loop on a json logs
#!/bin/bash
while read LINE; do
ID=(`echo $LINE | JQ -r .rayId`)
echo $ID
echo curl -g -XPUT "http://localhost:9200/elsv2/logs/$ID?pipeline=geoip-elsv2" -H 'Content-Type:application/json' --data-binary "'"$LINE"'"
curl -g -XPUT "http://localhost:9200/elsv2/logs/$ID?pipeline=geoip-elsv2" -H 'Content-Type:application/json' --data-binary "'"$LINE"'"
done < LOGPULL
The issue is I get:
{"error":{"root_cause":[{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}],"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"},"status":500}
Now in my loop i echo the line out:
curl -g -XPUT http://localhost:9200/elsv2/logs/37602b9101b872d1?pipeline=geoip-elsv2 -H Content-Type:application/json --data-binary @{"brandId":100,"flags":2,"hosterId":0,"ownerId":5531537,"rayId":"37602b9101b872d1","securityLevel":"med","timestamp":1498647918244999936,"unstablePublic":null,"zoneId":xxxxx,"zoneName":"xxxxx.one","zonePlan":"enterprise","client":{"asNum":60781,"country":"us","deviceType":"desktop","ip":"xxxxx","ipClass":"noRecord","srcPort":35408,"sslCipher":"NONE","sslFlags":0,"sslProtocol":"none"},"clientRequest":{"accept":"","body":null,"bodyBytes":0,"bytes":38,"cookies":null,"flags":0,"headers":,"httpHost":"xxxxx.one","httpMethod":"GET","httpProtocol":"HTTP/1.1","referer":"","uri":"/","userAgent":""},"edge":{"bbResult":"0","cacheResponseTime":0,"colo":20,"enabledFlags":106,"endTimestamp":1498647918249999872,"flServerIp":"104.16.85.188","flServerName":"20f164","flServerPort":80,"pathingOp":"wl","pathingSrc":"macro","pathingStatus":"nr","startTimestamp":1498647918244999936,"usedFlags":32,"rateLimit":{"ruleId":0,"mitigationId":null,"sourceId":"","processedRules":[{"ruleId":75132,"ruleSrc":"user","status":"allow","ruleType":"ban"}]},"dnsResponse":{"rcode":0,"error":"ok","cached":false,"duration":0,"errorMsg":"","overrideError":false}},"edgeResponse":{"bodyBytes":5,"bytes":322,"compressionRatio":0,"contentType":"","headers":null,"setCookies":null,"status":301}}
If i copy and paste this line direct then it works. is there something wrong in my formatting of the curl when i declare the attribute that holds the JSON?