graylog2-zabbix icon indicating copy to clipboard operation
graylog2-zabbix copied to clipboard

Json files are empty

Open karl007 opened this issue 5 years ago • 2 comments

Hi.

I had the problem that the json files after pull stay empty.

I checked everything and debugged the script.

The only thing I could fix ist was to replace the line 123

${CURL_BASE_CMD}${1} | jq '.' > $2

with a direct call of curl:

curl -u "$USERNAME":"$PASSWORD" -Ss "http://$HOSTNAME:$APIPORT/api$1" | jq '.' > $2

Don't know what the reason was, but now with " instead of ' and without ${} and wrap the url with " everything works.

Tried to put everything in the CURL_BASE_CMD var, but no success.

Maybe this helps someone.

Zabbix 3.2 Graylog 3.1 Debian 8.10 (Jessie) Bash 4.3.30

karl007 avatar Dec 18 '19 17:12 karl007

I had the same issue. Your solution solved the problem for me. Thank you.

trooster avatar May 05 '20 11:05 trooster

Had the same issue, and adding eval to the line you describe fixed it for me:

eval "${CURL_BASE_CMD}${1} | cat | jq '.' > $2"

Bash is probably unable to evaluate the first argument ${1} without using eval.

Stokvisss avatar May 20 '21 14:05 Stokvisss