我需要将Jenkins管道中的JSON数据发送到Splunk。我能够制作JSON数据。我指的是How do I send JSON files to Splunk Enterprise from JAVA?此链接。行号时出现错误。 5:已调用httppost.setEntity(new StringEntity(eventStr);)。请帮助...
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("https://<SERVER>:8088/services/collector/event");
httppost.addHeader("Authorization", " Splunk <token id>");
String eventStr = "{sourcetype=_json, index=main, event={ <JSON> }}"
httppost.setEntity(new StringEntity(eventStr);
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
System.out.println("response: " + entity);
我要下注您的错误消息说像“ unexpected token at <character count> on <line number>
”
[您在第5行上缺少分号(在分号之前),并且似乎在第2和4行上需要一些分号