running splunk enterprise locally
trying the folllowing code in my java app:
ServiceArgs serviceArgs = new ServiceArgs();
serviceArgs.setHost("localhost");
serviceArgs.setPort(8089);
serviceArgs.setUsername("admin");
serviceArgs.setPassword("admin");
serviceArgs.setScheme("http");
Service service = Service.connect(connArgs);
Receiver receiver = service.getReceiver();
Args args1 = new Args();
args1.put("sourcetype","mytestsourcetype");
receiver.log("main",args1,"{hello splunk}");
when I run this I get:
Exception in thread "main" java.lang.RuntimeException: Unexpected end of file from server
at com.splunk.HttpService.send(HttpService.java:427)
at com.splunk.Service.send(Service.java:1293)
at com.splunk.HttpService.post(HttpService.java:308)
at com.splunk.Service.login(Service.java:1122)
at com.splunk.Service.login(Service.java:1101)
at com.splunk.Service.connect(Service.java:187)
I know its most likely a newbie question but what settings do I need to set up in splunk
to make this work - is there an 'out of the box' configuration of host/user/pw/port
that should work, so I can send data to splunk? and how can i see this data in splunk?
do I need to set up an HTTP Event Collector in splunk to make this work,
or is there some other type of data input listener I need to set up?
thanks
Hey tmartindale78,
You can refer the doc below:
http://docs.splunk.com/DocumentationStatic/JavaSDK/1.2/com/splunk/Service.html
Let me know if this helps!!