And this code in PHP (ran from a linux machine) will produce the same error
$data = array("event"=>"php test");
$data_string = json_encode($data);
$ch = curl_init();
$headr = array();
$headr[] = 'Content-Type:application/json';
$headr[] = 'Authorization: Splunk 1EDC2170-023A-468A-9ADD-8A879755DC74';
$headr[] = 'Content-Lenght: ' . strlen(data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_URL,"https://splunkserver:8088/services/collector/event");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, data_string);
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
echo $server_output;
echo "<div>".$data_string."</div>"; `
will generate
{"text":"Invalid data format","code":6,"invalid-event-number":0}
{"event":"php test"}
Baffled what is wrong with the data format...
... View more