Every time I am getting error when I am trying to run following command:
curl -k https://instancename.cloud.splunk.com:8088/services/collector/event -H "Authorization: Splunk TOKEN" -d '{"event": "hello world"}'
This is my Self-service Splunk Cloud.
Even I tried with Postman with POST method and setting Authorization Key with token as Header, still getting There was an error connecting to https://instancename.cloud.splunk.com//services/collector/event.
Hello @swadeepmohanty ,
what is the exact error you are getting? Try this command:
time curl -k -vvvvv https://instancename.cloud.splunk.com:8088/services/collector/event -H "Authorization: Splunk TOKEN" -d '{"event": "hello world"}'
The prepended time command will show how long does the curl request take. The -vvvvv switch will show verbose info.
Let me know how it went.
Hello @swadeepmohanty ,
what is the exact error you are getting? Try this command:
time curl -k -vvvvv https://instancename.cloud.splunk.com:8088/services/collector/event -H "Authorization: Splunk TOKEN" -d '{"event": "hello world"}'
The prepended time command will show how long does the curl request take. The -vvvvv switch will show verbose info.
Let me know how it went.
By running the command with -vvvvv I am getting the following error:
* upload completely sent off: 8 out of 8 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Date: Sat, 18 Apr 2020 15:31:51 GMT
< Content-Type: application/json; charset=UTF-8
< X-Content-Type-Options: nosniff
< Content-Length: 64
< Vary: Authorization
< Connection: Keep-Alive
< X-Frame-Options: SAMEORIGIN
< Server: Splunkd
<
{"text":"Invalid data format","code":6,"invalid-event-number":0}* Connection #0 to host input-prd-p-5x72v3pzvdnj.cloud.splunk.com left intact
curl: (3) unmatched close brace/bracket in URL position 12:
hello world}'
ohh, you're on windows! 🙂
use double quote and escape them in json:
curl -k -vvvvv https://instancename.cloud.splunk.com:8088/services/collector/event -H "Authorization: Splunk TOKEN" -d "{\"event\": \"hello world\"}"
Awesome! It worked. 🙂