Fix insert-events.sh
Problem Description:
New training_run-*-events.json
files include ...,"host":"{\"ip\":\"10.42.0.221\"}",...
records instead of previous ...,"host":"192.168.44.15",...
. The script should escape quotes around curl brackets. Otherwise, the data inserted into ELK are wrong.
Solution 1:
Replace with ...,"host":{"ip":"10.42.0.221"},...
:
LINE=$(echo "$LINE" | sed 's/"[{]/\{/g' | sed 's/\}"/\}/g'| sed 's/\\//g' | sed 's/"\[/\[/g' | sed 's/\]"/\]/g')
Solution 2:
Replace with ...,"host":"{ip:10.42.0.221}",...
:
LINE=$(echo "$LINE" | sed 's/\\\"//g' | sed 's/\\//g' | sed 's/"\[/\[/g' | sed 's/\]"/\]/g')
Edited by Radek Ošlejšek